Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "annotations": {
- "list": [
- {
- "builtIn": 1,
- "datasource": {
- "type": "grafana",
- "uid": "-- Grafana --"
- },
- "enable": true,
- "hide": true,
- "iconColor": "rgba(0, 211, 255, 1)",
- "name": "Annotations & Alerts",
- "type": "dashboard"
- }
- ]
- },
- "editable": true,
- "fiscalYearStartMonth": 0,
- "graphTooltip": 0,
- "id": 12,
- "links": [],
- "panels": [
- {
- "datasource": {
- "type": "influxdb",
- "uid": "aegwpflul1rswc"
- },
- "fieldConfig": {
- "defaults": {},
- "overrides": []
- },
- "gridPos": {
- "h": 22,
- "w": 12,
- "x": 0,
- "y": 0
- },
- "id": 1,
- "options": {
- "autoZoom": true,
- "customLayer": {
- "attribution": "© <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",
- "enabled": false,
- "template": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
- },
- "defaultLayer": "Satellite",
- "lineColor": "red",
- "pointColor": "royalblue",
- "scrollWheelZoom": true,
- "showLayerChanger": true
- },
- "pluginVersion": "3.0.2",
- "targets": [
- {
- "datasource": {
- "type": "influxdb",
- "uid": "aegwpflul1rswc"
- },
- "query": "from(bucket: \"homeassistant\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"device_tracker.sm_s911b\")\r\n |> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")\r\n |> keep(columns: [\"_time\", \"latitude\", \"longitude\"])\r\n |> sort(columns: [\"_time\"], desc: false)",
- "refId": "A"
- }
- ],
- "title": "Map",
- "type": "pr0ps-trackmap-panel"
- },
- {
- "datasource": {
- "type": "influxdb",
- "uid": "ddohdqpqjy6f4e"
- },
- "fieldConfig": {
- "defaults": {
- "color": {
- "mode": "thresholds"
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- },
- "unit": "lengthkm"
- },
- "overrides": [
- {
- "matcher": {
- "id": "byName",
- "options": ""
- },
- "properties": []
- }
- ]
- },
- "gridPos": {
- "h": 7,
- "w": 12,
- "x": 12,
- "y": 0
- },
- "id": 2,
- "options": {
- "colorMode": "value",
- "graphMode": "area",
- "justifyMode": "auto",
- "orientation": "auto",
- "percentChangeColorMode": "standard",
- "reduceOptions": {
- "calcs": [
- "lastNotNull"
- ],
- "fields": "/.*/",
- "values": false
- },
- "showPercentChange": false,
- "textMode": "auto",
- "wideLayout": true
- },
- "pluginVersion": "11.5.2",
- "targets": [
- {
- "query": "import \"array\"\r\nimport \"experimental/geo\"\r\n\r\n// Retrieve data\r\ndata =\r\n from(bucket: \"homeassistant\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"device_tracker.sm_s911b\")\r\n |> filter(fn: (r) => r._field == \"latitude\" or r._field == \"longitude\")\r\n |> pivot(rowKey: [\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\") // Ensure lat/lon are in same row\r\n |> sort(columns: [\"_time\"], desc: false) // Sort by time\r\n\r\n// Compute total distance using the Haversine function\r\ntotalDistance = data\r\n |> reduce(\r\n identity: {\r\n lastLat: 0.0,\r\n lastLon: 0.0,\r\n totalDistance: 0.0,\r\n first: true,\r\n },\r\n fn: (r, accumulator) => {\r\n distance = if accumulator.first then\r\n 0.0\r\n else\r\n geo.ST_Distance(\r\n region: {lat: accumulator.lastLat, lon: accumulator.lastLon},\r\n geometry: {lat: r.latitude, lon: r.longitude}\r\n )\r\n\r\n return {\r\n lastLat: r.latitude,\r\n lastLon: r.longitude,\r\n totalDistance: accumulator.totalDistance + distance,\r\n first: false,\r\n }\r\n }\r\n )\r\n |> drop(columns: [\"lastLat\", \"lastLon\", \"first\"]) // Keep only totalDistance\r\n\r\ntotalDistance",
- "refId": "A"
- }
- ],
- "title": "Total Distance",
- "type": "stat"
- },
- {
- "datasource": {
- "type": "influxdb",
- "uid": "ddohdqpqjy6f4e"
- },
- "fieldConfig": {
- "defaults": {
- "color": {
- "mode": "palette-classic"
- },
- "custom": {
- "axisBorderShow": false,
- "axisCenteredZero": false,
- "axisColorMode": "text",
- "axisLabel": "",
- "axisPlacement": "auto",
- "barAlignment": 0,
- "barWidthFactor": 0.6,
- "drawStyle": "line",
- "fillOpacity": 100,
- "gradientMode": "hue",
- "hideFrom": {
- "legend": false,
- "tooltip": false,
- "viz": false
- },
- "insertNulls": false,
- "lineInterpolation": "linear",
- "lineStyle": {
- "fill": "solid"
- },
- "lineWidth": 1,
- "pointSize": 5,
- "scaleDistribution": {
- "type": "linear"
- },
- "showPoints": "auto",
- "spanNulls": false,
- "stacking": {
- "group": "A",
- "mode": "none"
- },
- "thresholdsStyle": {
- "mode": "off"
- }
- },
- "mappings": [],
- "thresholds": {
- "mode": "absolute",
- "steps": [
- {
- "color": "green",
- "value": null
- },
- {
- "color": "red",
- "value": 80
- }
- ]
- }
- },
- "overrides": []
- },
- "gridPos": {
- "h": 15,
- "w": 12,
- "x": 12,
- "y": 7
- },
- "id": 3,
- "options": {
- "legend": {
- "calcs": [],
- "displayMode": "list",
- "placement": "bottom",
- "showLegend": true
- },
- "tooltip": {
- "hideZeros": false,
- "mode": "single",
- "sort": "none"
- }
- },
- "pluginVersion": "11.5.2",
- "targets": [
- {
- "query": "from(bucket: \"homeassistant\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"device_tracker.sm_s911b\")\r\n |> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")\r\n |> keep(columns: [\"_time\", \"altitude\"])\r\n |> sort(columns: [\"_time\"], desc: false)",
- "refId": "A"
- }
- ],
- "title": "Altitude",
- "type": "timeseries"
- }
- ],
- "preload": false,
- "refresh": "",
- "schemaVersion": 40,
- "tags": [],
- "templating": {
- "list": []
- },
- "time": {
- "from": "now-24h",
- "to": "now"
- },
- "timepicker": {},
- "timezone": "browser",
- "title": "Map 2",
- "uid": "fehbv8ukobt34b",
- "version": 4,
- "weekStart": ""
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement