diff --git a/CHANGELOG.md b/CHANGELOG.md index bf72cb4c94..bec0cb8651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ### Improvements and bug fixes +- feat: use Grafana 11.2.3 + #### Build, CI, internal - ci: remove unknown flag --ref for gh cache delete in cleanup_caches workflow ([3a515df](https://github.com/teslamate-org/teslamate/commit/3a515df5aa400139acf8ef638e5ae37339c553cf) - @JakobLichterfeld) @@ -15,6 +17,11 @@ #### Dashboards +- fix: allow editing of dashboards - [changes will be overwritten on update](https://grafana.com/docs/grafana/latest/administration/provisioning/#making-changes-to-a-provisioned-dashboard) +- fix: ensure max speed panels are converted according to length unit setting in drive stats dashboard +- perf: speed up queries used to calculate max speed in drive stats dashboard +- feat: add a welcome dashboard + #### Translations #### Documentation diff --git a/grafana/Dockerfile b/grafana/Dockerfile index a4d0a79542..fa5090d2bc 100644 --- a/grafana/Dockerfile +++ b/grafana/Dockerfile @@ -1,6 +1,6 @@ # Ensure selecting a tag that is available for arm/v7, arm64, and amd64 # https://hub.docker.com/r/grafana/grafana/tags -FROM grafana/grafana:11.0.6-security-01 +FROM grafana/grafana:11.2.3 ENV GF_ANALYTICS_REPORTING_ENABLED=false \ GF_AUTH_ANONYMOUS_ENABLED=false \ @@ -12,6 +12,7 @@ ENV GF_ANALYTICS_REPORTING_ENABLED=false \ GF_USERS_ALLOW_SIGN_UP=false \ GF_USERS_DEFAULT_LANGUAGE=detect \ GF_DATE_FORMATS_USE_BROWSER_LOCALE=true \ + GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/dashboards_internal/home.json \ DATABASE_PORT=5432 \ DATABASE_SSL_MODE=disable diff --git a/grafana/dashboards.yml b/grafana/dashboards.yml index c093235f08..6c9e3f7bf8 100644 --- a/grafana/dashboards.yml +++ b/grafana/dashboards.yml @@ -7,7 +7,7 @@ providers: folderUid: Nr4ofiDZk type: file disableDeletion: false - editable: true + allowUiUpdates: true updateIntervalSeconds: 86400 options: path: /dashboards @@ -17,7 +17,7 @@ providers: folderUid: Nr5ofiDZk type: file disableDeletion: false - editable: true + allowUiUpdates: true updateIntervalSeconds: 86400 options: path: /dashboards_internal @@ -27,7 +27,7 @@ providers: folderUid: Nr6ofiDZk type: file disableDeletion: false - editable: true + allowUiUpdates: true updateIntervalSeconds: 86400 options: path: /dashboards_reports diff --git a/grafana/dashboards/battery-health.json b/grafana/dashboards/battery-health.json index 25af196210..f2a84d7225 100644 --- a/grafana/dashboards/battery-health.json +++ b/grafana/dashboards/battery-health.json @@ -17,7 +17,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -150,7 +150,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -298,7 +298,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -402,7 +402,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -414,7 +414,7 @@ "hide": false, "rawQuery": true, "rawSql": "select ROUND(convert_km(sum(distance)::numeric, '$length_unit'),0)|| ' $length_unit' as \"Logged\"\r\nfrom drives \r\nwhere car_id = $car_id;\r\n", - "refId": "Looged", + "refId": "Logged", "sql": { "columns": [ { @@ -658,7 +658,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.6", "targets": [ { "datasource": { @@ -774,7 +773,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -873,7 +872,7 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -999,7 +998,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1246,7 +1245,7 @@ "text": {}, "valueMode": "color" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1441,7 +1440,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1453,7 +1452,7 @@ "hide": false, "rawQuery": true, "rawSql": "SELECT ('$aux'::json -> 'RatedEfficiency')::text::float * \r\n CASE \r\n WHEN '$length_unit' = 'km' THEN 10\r\n WHEN '$length_unit' = 'mi' THEN 16.0934 \r\n END AS efficiency_$length_unit", - "refId": "Looged", + "refId": "Logged", "sql": { "columns": [ { @@ -1541,7 +1540,7 @@ "text": {}, "valueMode": "color" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1631,14 +1630,17 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "fillOpacity": 50, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, + "pointShape": "circle", "pointSize": { "fixed": 6 }, + "pointStrokeWidth": 1, "scaleDistribution": { "type": "linear" }, @@ -1675,6 +1677,33 @@ "value": "lines" } ] + }, + { + "matcher": { + "id": "byName", + "options": "kWh" + }, + "properties": [ + { + "id": "custom.pointSize.fixed", + "value": 5 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "M-kWh" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-red", + "mode": "fixed" + } + } + ] } ] }, @@ -1692,37 +1721,62 @@ "placement": "bottom", "showLegend": false }, + "mapping": "manual", "series": [ { - "name": "Odometer", - "pointColor": { - "field": "kWh" + "color": { + "matcher": { + "id": "byName", + "options": "kWh" + } }, - "pointSize": { - "fixed": 5, - "max": 100, - "min": 1 + "frame": { + "matcher": { + "id": "byIndex", + "options": 0 + } }, - "x": "Odometer", - "y": "kWh" + "x": { + "matcher": { + "id": "byName", + "options": "Odometer" + } + }, + "y": { + "matcher": { + "id": "byName", + "options": "kWh" + } + } }, { - "name": "Median Odometer", - "pointColor": { - "fixed": "dark-red" + "frame": { + "matcher": { + "id": "byIndex", + "options": 1 + } }, - "x": "M-Odometer", - "y": "M-kWh" + "x": { + "matcher": { + "id": "byName", + "options": "M-Odometer" + } + }, + "y": { + "matcher": { + "id": "byName", + "options": "M-kWh" + } + } } ], - "seriesMapping": "manual", "tooltip": { "maxHeight": 600, "mode": "single", "sort": "none" } }, - "pluginVersion": "8.5.6", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1999,6 +2053,6 @@ "timezone": "browser", "title": "Battery Health", "uid": "jchmRiqUfXgTM", - "version": 11, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/charge-level.json b/grafana/dashboards/charge-level.json index 78edf73920..2cf04c2ce3 100644 --- a/grafana/dashboards/charge-level.json +++ b/grafana/dashboards/charge-level.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -96,6 +96,7 @@ "axisLabel": "Charge Level", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -163,7 +164,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "alias": "", @@ -365,7 +365,7 @@ }, { "current": { - "selected": true, + "selected": false, "text": "2h", "value": "7200" }, @@ -399,7 +399,7 @@ }, { "current": { - "selected": true, + "selected": false, "text": "yes", "value": "1" }, @@ -427,7 +427,7 @@ }, { "current": { - "selected": true, + "selected": false, "text": "1/6 of interval", "value": "6" }, @@ -507,6 +507,6 @@ "timezone": "", "title": "Charge Level", "uid": "WopVO_mgz", - "version": 22, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/charges.json b/grafana/dashboards/charges.json index d68cd2a66a..37c755a52c 100644 --- a/grafana/dashboards/charges.json +++ b/grafana/dashboards/charges.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.6+security-01" + "version": "11.2.3" }, { "type": "datasource", @@ -150,6 +150,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -161,7 +162,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -247,6 +248,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -258,7 +260,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -345,6 +347,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -356,7 +359,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -444,6 +447,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -455,7 +459,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -534,7 +538,7 @@ { "targetBlank": false, "title": "View charge details", - "url": "d/BHhxFeZRz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric}" + "url": "d/BHhxFeZRz/charge-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric}" } ] }, @@ -720,7 +724,7 @@ }, { "id": "custom.minWidth", - "value": 60 + "value": 70 } ] }, @@ -1169,7 +1173,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1257,7 +1261,7 @@ "content": "From here you can check if you have \nincomplete data of **Charges** (charges without ending date)\nIf so, you may follow the official \nguide by Manually fixing data", "mode": "markdown" }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1346,7 +1350,7 @@ }, "showHeader": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1634,7 +1638,6 @@ "from": "now-3M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -1663,6 +1666,6 @@ "timezone": "", "title": "Charges", "uid": "TSmNYvRRk", - "version": 7, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/charging-stats.json b/grafana/dashboards/charging-stats.json index 433e50edbc..1c00d12a66 100644 --- a/grafana/dashboards/charging-stats.json +++ b/grafana/dashboards/charging-stats.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -139,7 +139,7 @@ }, "gridPos": { "h": 3, - "w": 5, + "w": 3, "x": 0, "y": 1 }, @@ -167,7 +167,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -228,8 +228,8 @@ }, "gridPos": { "h": 3, - "w": 5, - "x": 5, + "w": 3, + "x": 3, "y": 1 }, "id": 10, @@ -256,7 +256,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -319,7 +319,7 @@ "gridPos": { "h": 3, "w": 3, - "x": 10, + "x": 6, "y": 1 }, "id": 14, @@ -346,7 +346,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -381,7 +381,7 @@ ] } ], - "title": "Charging Cost at SuC", + "title": "SuC Charging Cost", "type": "stat" }, { @@ -409,7 +409,7 @@ "gridPos": { "h": 3, "w": 3, - "x": 13, + "x": 9, "y": 1 }, "id": 27, @@ -436,7 +436,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -498,8 +498,8 @@ }, "gridPos": { "h": 3, - "w": 2, - "x": 16, + "w": 3, + "x": 12, "y": 1 }, "id": 26, @@ -520,7 +520,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -573,7 +573,7 @@ ] } ], - "title": "Cost per 100 $length_unit", + "title": "Ø Cost per 100 $length_unit", "type": "stat" }, { @@ -602,8 +602,8 @@ }, "gridPos": { "h": 3, - "w": 2, - "x": 18, + "w": 3, + "x": 15, "y": 1 }, "id": 31, @@ -624,7 +624,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -649,7 +649,7 @@ ] } ], - "title": "Average Cost per kWh", + "title": "Ø Cost per kWh", "type": "stat" }, { @@ -678,8 +678,8 @@ }, "gridPos": { "h": 3, - "w": 2, - "x": 20, + "w": 3, + "x": 18, "y": 1 }, "id": 32, @@ -700,7 +700,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -743,7 +743,7 @@ ] } ], - "title": "DC Avg Cost per kWh", + "title": "Ø Cost per kWh DC", "type": "stat" }, { @@ -772,8 +772,8 @@ }, "gridPos": { "h": 3, - "w": 2, - "x": 22, + "w": 3, + "x": 21, "y": 1 }, "id": 33, @@ -794,7 +794,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -837,7 +837,7 @@ ] } ], - "title": "AC Avg Cost per kWh", + "title": "Ø Cost per kWh AC", "type": "stat" }, { @@ -929,7 +929,7 @@ "unit": "short" } }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "reverseYBuckets": false, "targets": [ { @@ -1001,6 +1001,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 35, "gradientMode": "none", @@ -1102,7 +1103,6 @@ "sort": "desc" } }, - "pluginVersion": "8.5.4", "targets": [ { "datasource": { @@ -1472,7 +1472,7 @@ "zoom": 15 } }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1672,14 +1672,17 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "fillOpacity": 50, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, + "pointShape": "circle", "pointSize": { "fixed": 3 }, + "pointStrokeWidth": 1, "scaleDistribution": { "type": "linear" }, @@ -1713,11 +1716,23 @@ "value": [ { "title": "Show charge details", - "url": "d/BHhxFeZRz?from=${__data.fields.start_date.numeric}&to=${__data.fields.end_date.numeric}&var-car_id=${car_id}&var-charging_process_id=${__data.fields.charging_process_id.numeric}" + "url": "d/BHhxFeZRz/charge-details?from=${__data.fields.start_date.numeric}&to=${__data.fields.end_date.numeric}&var-car_id=${car_id}&var-charging_process_id=${__data.fields.charging_process_id.numeric}" } ] } ] + }, + { + "matcher": { + "id": "byName", + "options": "B - Avg Power [kW]" + }, + "properties": [ + { + "id": "custom.pointSize.fixed", + "value": 15 + } + ] } ] }, @@ -1729,47 +1744,86 @@ }, "id": 29, "options": { - "dims": { - "exclude": [ - "charging_process_id" - ], - "frame": 0 - }, "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": false }, + "mapping": "manual", "series": [ { - "pointColor": { - "field": "Power [kW]" + "color": { + "matcher": { + "id": "byName", + "options": "Power [kW]" + } }, - "x": "SOC [%]", - "y": "Power [kW]" + "frame": { + "matcher": { + "id": "byIndex", + "options": 0 + } + }, + "x": { + "matcher": { + "id": "byName", + "options": "SOC [%]" + } + }, + "y": { + "exclude": { + "id": "byNames", + "options": [ + "charging_process_id" + ] + }, + "matcher": { + "id": "byName", + "options": "Power [kW]" + } + } }, { - "pointColor": { - "field": "B - Avg Power [kW]" + "color": { + "matcher": { + "id": "byName", + "options": "B - Avg Power [kW]" + } }, - "pointSize": { - "fixed": 15, - "max": 100, - "min": 1 + "frame": { + "matcher": { + "id": "byIndex", + "options": 1 + } }, - "x": "B - SOC [%]", - "y": "B - Avg Power [kW]" + "x": { + "matcher": { + "id": "byName", + "options": "B - SOC [%]" + } + }, + "y": { + "exclude": { + "id": "byNames", + "options": [ + "charging_process_id" + ] + }, + "matcher": { + "id": "byName", + "options": "B - Avg Power [kW]" + } + } } ], - "seriesMapping": "manual", "tooltip": { "maxHeight": 600, "mode": "single", "sort": "none" } }, - "pluginVersion": "7.5.11", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1870,7 +1924,8 @@ "cellOptions": { "type": "auto" }, - "inspect": false + "inspect": false, + "minWidth": 50 }, "mappings": [], "thresholds": { @@ -1892,7 +1947,7 @@ "properties": [ { "id": "custom.width", - "value": 70 + "value": 50 }, { "id": "displayName", @@ -1924,7 +1979,8 @@ "id": "custom.cellOptions", "value": { "mode": "gradient", - "type": "gauge" + "type": "gauge", + "valueDisplayMode": "text" } }, { @@ -1933,6 +1989,10 @@ { "id": "min", "value": 0 + }, + { + "id": "custom.align", + "value": "left" } ] } @@ -1958,7 +2018,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2062,7 +2122,8 @@ "cellOptions": { "type": "auto" }, - "inspect": false + "inspect": false, + "minWidth": 50 }, "mappings": [], "thresholds": { @@ -2122,7 +2183,7 @@ }, { "id": "custom.width", - "value": 70 + "value": 50 } ] }, @@ -2146,6 +2207,10 @@ { "id": "min", "value": 0 + }, + { + "id": "custom.align", + "value": "left" } ] } @@ -2171,7 +2236,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2290,7 +2355,7 @@ }, "showHeader": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2413,7 +2478,7 @@ }, "showHeader": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2562,6 +2627,6 @@ "timezone": "", "title": "Charging Stats", "uid": "-pkIkhmRz", - "version": 11, + "version": 2, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/drive-stats.json b/grafana/dashboards/drive-stats.json index 6f439001a6..91043aaf08 100644 --- a/grafana/dashboards/drive-stats.json +++ b/grafana/dashboards/drive-stats.json @@ -1,6 +1,12 @@ { "__elements": {}, "__requires": [ + { + "type": "panel", + "id": "barchart", + "name": "Bar chart", + "version": "" + }, { "type": "panel", "id": "bargauge", @@ -11,7 +17,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.1" + "version": "11.2.3" }, { "type": "datasource", @@ -118,7 +124,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -250,7 +256,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -357,7 +363,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -497,7 +503,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -630,7 +636,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -696,7 +702,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -784,6 +790,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -795,7 +802,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -807,7 +814,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT max(speed) AS speed_[[length_unit]]h\nFROM positions\nWHERE car_id = $car_id AND $__timeFilter(date);", + "rawSql": "SELECT convert_km(max(speed_max), '$length_unit') AS speed_${length_unit}h\nFROM drives\nWHERE car_id = $car_id and $__timeFilter(start_date);", "refId": "A", "select": [ [ @@ -925,6 +932,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -936,7 +944,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -948,7 +956,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT max(speed) AS speed_[[length_unit]]h\nFROM positions\nWHERE car_id = $car_id AND $__timeFilter(date);", + "rawSql": "SELECT convert_km(max(speed_max), '$length_unit') AS speed_${length_unit}h\nFROM drives\nWHERE car_id = $car_id and $__timeFilter(start_date);", "refId": "A", "select": [ [ @@ -1067,6 +1075,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -1078,7 +1087,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1090,7 +1099,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT max(speed) AS speed_[[length_unit]]h\nFROM positions\nWHERE car_id = $car_id AND $__timeFilter(date);", + "rawSql": "SELECT convert_km(max(speed_max), '$length_unit') AS speed_${length_unit}h\nFROM drives\nWHERE car_id = $car_id and $__timeFilter(start_date);", "refId": "A", "select": [ [ @@ -1233,7 +1242,6 @@ "xTickLabelRotation": 0, "xTickLabelSpacing": 0 }, - "pluginVersion": "10.4.0", "targets": [ { "datasource": { @@ -1245,7 +1253,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH drivedata AS (\r\n SELECT\r\n ROUND(convert_km(p.speed::numeric, '$length_unit') / 10, 0) * 10 AS speed_section_$length_unit,\r\n EXTRACT(EPOCH FROM (LEAD(p.\"date\") OVER (ORDER BY p.\"date\") - p.\"date\")) AS seconds_elapsed\r\n FROM drives d\r\n INNER JOIN positions p ON p.drive_id = d.id\r\n WHERE d.car_id = $car_id AND $__timeFilter(d.start_date) AND p.ideal_battery_range_km IS NOT NULL\r\n),\r\nTotalDuration AS (\r\n SELECT SUM(seconds_elapsed) AS total_elapsed_time\r\n FROM drivedata\r\n WHERE speed_section_$length_unit > 0\r\n)\r\nSELECT \r\n speed_section_$length_unit AS \"Speed\",\r\n SUM(seconds_elapsed) * 100 / (SELECT total_elapsed_time FROM TotalDuration) AS \"Elapsed\", \r\n TO_CHAR((SUM(seconds_elapsed) || ' second')::interval, 'HH24:MI:SS') AS \"Time\"\r\nFROM drivedata\r\nWHERE speed_section_$length_unit > 0\r\nGROUP BY speed_section_$length_unit\r\nORDER BY speed_section_$length_unit;\r\n", + "rawSql": "WITH drivedata AS (\r\n SELECT\r\n ROUND(convert_km(p.speed::numeric, '$length_unit') / 10, 0) * 10 AS speed_section_${length_unit},\r\n EXTRACT(EPOCH FROM (LEAD(p.\"date\") OVER (PARTITION BY p.drive_id ORDER BY p.\"date\") - p.\"date\")) AS seconds_elapsed\r\n FROM positions p\r\n WHERE p.car_id = $car_id AND $__timeFilter(p.date) AND p.ideal_battery_range_km IS NOT NULL\r\n)\r\n\r\nSELECT \r\n speed_section_${length_unit} AS \"Speed\",\r\n SUM(seconds_elapsed) * 100 / SUM(SUM(seconds_elapsed)) OVER () AS \"Elapsed\", \r\n TO_CHAR((SUM(seconds_elapsed) || ' second')::interval, 'HH24:MI:SS') AS \"Time\"\r\nFROM drivedata\r\nWHERE speed_section_${length_unit} > 0\r\nGROUP BY speed_section_${length_unit}\r\nORDER BY speed_section_${length_unit};\r\n", "refId": "A", "select": [ [ @@ -1378,7 +1386,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1511,7 +1519,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1614,7 +1622,7 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1863,6 +1871,6 @@ "timezone": "", "title": "Drive Stats", "uid": "_7WkNSyWk", - "version": 14, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/drives.json b/grafana/dashboards/drives.json index 996ce83168..7d4a8c26e7 100644 --- a/grafana/dashboards/drives.json +++ b/grafana/dashboards/drives.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.1" + "version": "11.2.3" }, { "type": "datasource", @@ -151,6 +151,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -162,7 +163,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -250,6 +251,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -261,7 +263,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -368,6 +370,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -379,7 +382,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -488,6 +491,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [], "fields": "", @@ -497,7 +501,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -593,7 +597,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null } ] } @@ -619,7 +624,7 @@ { "targetBlank": false, "title": "View drive details", - "url": "d/zm7wN6Zgz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-drive_id=${__data.fields.drive_id.numeric}" + "url": "d/zm7wN6Zgz/drive-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-drive_id=${__data.fields.drive_id.numeric}" } ] }, @@ -742,7 +747,8 @@ "mode": "absolute", "steps": [ { - "color": "super-light-green" + "color": "super-light-green", + "value": null }, { "color": "green", @@ -858,7 +864,8 @@ "mode": "absolute", "steps": [ { - "color": "super-light-blue" + "color": "super-light-blue", + "value": null }, { "color": "super-light-green", @@ -1078,7 +1085,8 @@ "mode": "absolute", "steps": [ { - "color": "super-light-blue" + "color": "super-light-blue", + "value": null }, { "color": "super-light-green", @@ -1404,7 +1412,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1417,7 +1425,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n car.id as car_id,\n CASE WHEN start_geofence.id IS NULL THEN CONCAT('new?lat=', start_position.latitude, '&lng=', start_position.longitude)\n WHEN start_geofence.id IS NOT NULL THEN CONCAT(start_geofence.id, '/edit')\n END as start_path,\n CASE WHEN end_geofence.id IS NULL THEN CONCAT('new?lat=', end_position.latitude, '&lng=', end_position.longitude)\n WHEN end_geofence.id IS NOT NULL THEN CONCAT(end_geofence.id, '/edit')\n END as end_path,\n TO_CHAR((duration_min * INTERVAL '1 minute'), 'HH24:MI') as duration_str,\n drives.id as drive_id,\n -- Columns\n start_date,\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS start_address,\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS end_address,\n duration_min,\n distance,\n start_position.usable_battery_level as start_usable_battery_level,\n start_position.battery_level as start_battery_level,\n end_position.usable_battery_level as end_usable_battery_level,\n end_position.battery_level as end_battery_level,\n case when (start_position.battery_level != start_position.usable_battery_level OR end_position.battery_level != end_position.usable_battery_level) = true then true else false end as reduced_range,\n duration_min > 1 AND distance > 1 AND ( \n start_position.usable_battery_level IS NULL OR end_position.usable_battery_level IS NULL\tOR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) as is_sufficiently_precise,\n NULLIF(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0), 0) as range_diff,\n car.efficiency as car_efficiency,\n outside_temp_avg,\n distance / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 AS avg_speed,\n\tspeed_max,\n power_max\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id \n AND convert_km(distance::numeric, '$length_unit') >= $min_dist \n AND convert_km(distance::numeric, '$length_unit') / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 >= $min_speed \n AND ('${geofence:pipe}' = '-1' OR start_geofence.id in ($geofence) OR end_geofence.id in ($geofence)) \n ORDER BY start_date DESC\n)\nSELECT\n start_date_ts,\n end_date_ts,\n car_id,\n start_path,\n end_path,\n duration_str,\n drive_id,\n -- Columns\n start_date,\n start_address,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n start_battery_level as \"% Start\",\n end_battery_level as \"% End\",\n convert_celsius(outside_temp_avg, '$temp_unit') AS outside_temp_$temp_unit,\n convert_km(avg_speed::numeric, '$length_unit') AS speed_avg_$length_unit,\n convert_km(speed_max::numeric, '$length_unit') AS speed_max_$length_unit,\n power_max,\n reduced_range as has_reduced_range,\n CASE WHEN is_sufficiently_precise THEN distance / range_diff\n ELSE NULL\n END AS efficiency,\n range_diff * car_efficiency as \"consumption_kWh\",\n CASE WHEN is_sufficiently_precise THEN range_diff * car_efficiency / distance * 1000 * CASE WHEN '$length_unit' = 'km' THEN 1\n WHEN '$length_unit' = 'mi' THEN 1.60934\n END\n END AS consumption_kWh_$length_unit\nFROM data\nWHERE\n start_address ILIKE '%$location%' OR end_address ILIKE '%$location%';", + "rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n car.id as car_id,\n CASE WHEN start_geofence.id IS NULL THEN CONCAT('new?lat=', start_position.latitude, '&lng=', start_position.longitude)\n WHEN start_geofence.id IS NOT NULL THEN CONCAT(start_geofence.id, '/edit')\n END as start_path,\n CASE WHEN end_geofence.id IS NULL THEN CONCAT('new?lat=', end_position.latitude, '&lng=', end_position.longitude)\n WHEN end_geofence.id IS NOT NULL THEN CONCAT(end_geofence.id, '/edit')\n END as end_path,\n TO_CHAR((duration_min * INTERVAL '1 minute'), 'HH24:MI') as duration_str,\n drives.id as drive_id,\n -- Columns\n start_date,\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS start_address,\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS end_address,\n duration_min,\n distance,\n start_position.usable_battery_level as start_usable_battery_level,\n start_position.battery_level as start_battery_level,\n end_position.usable_battery_level as end_usable_battery_level,\n end_position.battery_level as end_battery_level,\n case when (start_position.battery_level != start_position.usable_battery_level OR end_position.battery_level != end_position.usable_battery_level) = true then true else false end as reduced_range,\n duration_min > 1 AND distance > 1 AND ( \n start_position.usable_battery_level IS NULL OR end_position.usable_battery_level IS NULL\tOR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) as is_sufficiently_precise,\n NULLIF(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0), 0) as range_diff,\n car.efficiency as car_efficiency,\n outside_temp_avg,\n distance / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 AS avg_speed,\n\tspeed_max,\n power_max\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id \n AND convert_km(distance::numeric, '$length_unit') >= $min_dist \n AND convert_km(distance::numeric, '$length_unit') / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 >= $min_speed \n AND ('${geofence:pipe}' = '-1' OR start_geofence.id in ($geofence) OR end_geofence.id in ($geofence)) \n ORDER BY start_date DESC\n)\nSELECT\n start_date_ts,\n end_date_ts,\n car_id,\n start_path,\n end_path,\n duration_str,\n drive_id,\n -- Columns\n start_date,\n start_address,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n start_battery_level as \"% Start\",\n end_battery_level as \"% End\",\n convert_celsius(outside_temp_avg, '$temp_unit') AS outside_temp_$temp_unit,\n convert_km(avg_speed::numeric, '$length_unit') AS speed_avg_$length_unit,\n convert_km(speed_max::numeric, '$length_unit') AS speed_max_$length_unit,\n power_max,\n reduced_range as has_reduced_range,\n CASE WHEN is_sufficiently_precise THEN distance / range_diff\n ELSE NULL\n END AS efficiency,\n range_diff * car_efficiency as \"consumption_kWh\",\n CASE WHEN is_sufficiently_precise THEN range_diff * car_efficiency / convert_km(distance::numeric, '$length_unit') * 1000\n END AS consumption_kWh_$length_unit\nFROM data\nWHERE\n start_address ILIKE '%$location%' OR end_address ILIKE '%$location%';", "refId": "A", "select": [ [ @@ -1493,7 +1501,7 @@ "content": "From here you can check if you have \nincomplete data of **Drives** (drives without ending date)\nIf so, you may follow the official \nguide by Manually fixing data", "mode": "markdown" }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1582,7 +1590,7 @@ }, "showHeader": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1849,6 +1857,6 @@ "timezone": "", "title": "Drives", "uid": "Y8upc6ZRk", - "version": 6, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/efficiency.json b/grafana/dashboards/efficiency.json index 4289ce7fab..6e1d516cb0 100644 --- a/grafana/dashboards/efficiency.json +++ b/grafana/dashboards/efficiency.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -158,6 +158,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -169,18 +170,19 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "select \n sum((start_${preferred_range}_range_km - end_${preferred_range}_range_km) * cars.efficiency) / sum(distance) * 1000 * \n CASE WHEN '$length_unit' = 'km' THEN 1\n WHEN '$length_unit' = 'mi' THEN 1.60934\n END AS \"consumption_$length_unit\"\nfrom drives \ninner join cars on cars.id = car_id\nwhere \n distance is not null and\n start_${preferred_range}_range_km - end_${preferred_range}_range_km >= 0.1 and\n car_id = $car_id", + "rawSql": "select \n sum((start_${preferred_range}_range_km - end_${preferred_range}_range_km) * cars.efficiency) / convert_km(sum(distance)::numeric, '$length_unit') * 1000 AS \"consumption_$length_unit\"\nfrom drives \ninner join cars on cars.id = car_id\nwhere \n distance is not null and\n start_${preferred_range}_range_km - end_${preferred_range}_range_km >= 0.1 and\n car_id = $car_id", "refId": "A", "select": [ [ @@ -192,6 +194,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -272,6 +291,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -283,18 +303,19 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH d1 AS (\n\tSELECT\n\t\tc.car_id,\n\t\tlag(end_${preferred_range}_range_km) OVER (ORDER BY start_date) - start_${preferred_range}_range_km AS range_loss,\n\t\tp.odometer - lag(p.odometer) OVER (ORDER BY start_date) AS distance\n\tFROM\n\t\tcharging_processes c\n\tLEFT JOIN positions p ON p.id = c.position_id \n\tWHERE\n\t end_date IS NOT NULL AND\n\t c.car_id = $car_id\n\tORDER BY\n\t\tstart_date\n),\nd2 AS (\nSELECT\n\tcar_id,\n\tsum(range_loss) AS range_loss,\n\tsum(distance) AS distance\nFROM\n\td1\nWHERE\n\tdistance >= 0 AND range_loss >= 0\nGROUP BY\n\tcar_id\n)\nSELECT\nrange_loss * c.efficiency / distance * 1000 *\n CASE WHEN '$length_unit' = 'km' THEN 1\n WHEN '$length_unit' = 'mi' THEN 1.60934\n END AS \"consumption_$length_unit\"\nFROM\n\td2\n\tLEFT JOIN cars c ON c.id = car_id", + "rawSql": "WITH d1 AS (\n\tSELECT\n\t\tc.car_id,\n\t\tlag(end_${preferred_range}_range_km) OVER (ORDER BY start_date) - start_${preferred_range}_range_km AS range_loss,\n\t\tp.odometer - lag(p.odometer) OVER (ORDER BY start_date) AS distance\n\tFROM\n\t\tcharging_processes c\n\tLEFT JOIN positions p ON p.id = c.position_id \n\tWHERE\n\t end_date IS NOT NULL AND\n\t c.car_id = $car_id\n\tORDER BY\n\t\tstart_date\n),\nd2 AS (\nSELECT\n\tcar_id,\n\tsum(range_loss) AS range_loss,\n\tsum(distance) AS distance\nFROM\n\td1\nWHERE\n\tdistance >= 0 AND range_loss >= 0\nGROUP BY\n\tcar_id\n)\nSELECT\nrange_loss * c.efficiency / convert_km(distance::numeric, '$length_unit') * 1000 AS \"consumption_$length_unit\"\nFROM\n\td2\n\tLEFT JOIN cars c ON c.id = car_id", "refId": "A", "select": [ [ @@ -306,6 +327,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -386,6 +424,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -397,7 +436,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -443,6 +482,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -701,18 +741,19 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH t AS (\n\tSELECT\n\t CASE WHEN '$temp_unit' = 'C' THEN ROUND(cast(outside_temp_avg AS numeric) / 5, 0) * 5 \n\t\t\t WHEN '$temp_unit' = 'F' THEN ROUND(cast(convert_celsius(outside_temp_avg, '$temp_unit') AS numeric) / 10, 0) * 10\n\t\tEND AS outside_temp,\n\t\tsum(start_ideal_range_km - end_ideal_range_km) AS total_ideal_range,\n\t\tsum(start_rated_range_km - end_rated_range_km) AS total_rated_range,\n\t\tsum(distance) AS total_distance,\n\t\tsum(duration_min) as duration,\n\t\tcar_id\n\tFROM\n\t\tdrives\n\tWHERE\n\t\tdistance IS NOT NULL\n\t\tAND car_id = $car_id\n\t\tAND convert_km(distance::numeric, '$length_unit') >= $min_distance \n\t\tAND start_${preferred_range}_range_km - end_${preferred_range}_range_km > 0.1\n\tGROUP BY\n\t\t1,\n\t\tcar_id\n)\n\nSELECT\n\toutside_temp as outside_temp_$temp_unit,\n total_distance / total_${preferred_range}_range AS efficiency,\n\ttotal_${preferred_range}_range / total_distance * c.efficiency * 1000 * \n CASE \n WHEN '$length_unit' = 'km' THEN 1 \n WHEN '$length_unit' = 'mi' THEN 1.60934 \n END AS consumption_$length_unit,\n convert_km(total_distance::numeric, '$length_unit') as total_distance_$length_unit,\n\t(total_distance / duration) * 60 / (CASE \n WHEN '$length_unit' = 'km' THEN 1 \n WHEN '$length_unit' = 'mi' THEN 1.60934 \n END) avg_speed_$length_unit\nFROM\n\tt\nJOIN cars c ON t.car_id = c.id\nWHERE outside_temp IS NOT NULL\norder by 1 desc\n", + "rawSql": "WITH t AS (\n\tSELECT\n\t CASE WHEN '$temp_unit' = 'C' THEN ROUND(cast(outside_temp_avg AS numeric) / 5, 0) * 5 \n\t\t\t WHEN '$temp_unit' = 'F' THEN ROUND(cast(convert_celsius(outside_temp_avg, '$temp_unit') AS numeric) / 10, 0) * 10\n\t\tEND AS outside_temp,\n\t\tsum(start_ideal_range_km - end_ideal_range_km) AS total_ideal_range,\n\t\tsum(start_rated_range_km - end_rated_range_km) AS total_rated_range,\n\t\tsum(distance) AS total_distance,\n\t\tsum(duration_min) as duration,\n\t\tcar_id\n\tFROM\n\t\tdrives\n\tWHERE\n\t\tdistance IS NOT NULL\n\t\tAND car_id = $car_id\n\t\tAND convert_km(distance::numeric, '$length_unit') >= $min_distance \n\t\tAND start_${preferred_range}_range_km - end_${preferred_range}_range_km > 0.1\n\tGROUP BY\n\t\t1,\n\t\tcar_id\n)\n\nSELECT\n\toutside_temp as outside_temp_$temp_unit,\n total_distance / total_${preferred_range}_range AS efficiency,\n\ttotal_${preferred_range}_range / convert_km(total_distance::numeric, '$length_unit') * c.efficiency * 1000 AS consumption_$length_unit,\n convert_km(total_distance::numeric, '$length_unit') as total_distance_$length_unit,\n\t(convert_km(total_distance::numeric, '$length_unit') / duration) * 60 as avg_speed_$length_unit\nFROM\n\tt\nJOIN cars c ON t.car_id = c.id\nWHERE outside_temp IS NOT NULL\norder by 1 desc\n", "refId": "A", "select": [ [ @@ -724,6 +765,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -804,6 +862,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -815,18 +874,19 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n\tCASE WHEN '$length_unit' = 'km' THEN efficiency\n\t WHEN '$length_unit' = 'mi' THEN efficiency * 1.60934\n\tEND * 1000 as \"efficiency_$length_unit\"\nFROM\n\tcars\nWHERE\n\tid = $car_id;", + "rawSql": "SELECT\n\tefficiency / convert_km(1, '$length_unit') * 1000 as \"efficiency_$length_unit\"\nFROM\n\tcars\nWHERE\n\tid = $car_id;", "refId": "A", "select": [ [ @@ -838,6 +898,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charges", "timeColumn": "date", "timeColumnType": "timestamp", @@ -861,6 +938,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -932,18 +1010,19 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n round((charge_energy_added / NULLIF(end_ideal_range_km - start_ideal_range_km, 0))::numeric *\n\t CASE WHEN '$length_unit' = 'km' THEN 1.0\n\t WHEN '$length_unit' = 'mi' THEN 1.60934\n\t END, 3) * 1000 as \"efficiency_$length_unit\",\n count(*) as count\nFROM\n charging_processes\nWHERE \n car_id = $car_id\n AND duration_min > 10\n AND end_battery_level <= 95\n AND start_ideal_range_km IS NOT NULL\n AND end_ideal_range_km IS NOT NULL\n AND charge_energy_added > 0\nGROUP BY\n 1\nORDER BY\n 2 DESC\nLIMIT 3", + "rawSql": "SELECT\n round((charge_energy_added / NULLIF(end_ideal_range_km - start_ideal_range_km, 0))::numeric / convert_km(1, '$length_unit'), 3) * 1000 as \"efficiency_$length_unit\",\n count(*) as count\nFROM\n charging_processes\nWHERE \n car_id = $car_id\n AND duration_min > 10\n AND end_battery_level <= 95\n AND start_ideal_range_km IS NOT NULL\n AND end_ideal_range_km IS NOT NULL\n AND charge_energy_added > 0\nGROUP BY\n 1\nORDER BY\n 2 DESC\nLIMIT 3", "refId": "A", "select": [ [ @@ -955,6 +1034,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charges", "timeColumn": "date", "timeColumnType": "timestamp", @@ -978,6 +1074,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -1049,18 +1146,19 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n round((charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric *\n\t CASE WHEN '$length_unit' = 'km' THEN 1.0\n\t WHEN '$length_unit' = 'mi' THEN 1.60934\n\t END, 3) * 1000 as \"efficiency_$length_unit\",\n\tcount(*) as count\nFROM\n charging_processes\nWHERE \n car_id = $car_id\n AND duration_min > 10\n AND end_battery_level <= 95\n AND start_rated_range_km IS NOT NULL\n AND end_rated_range_km IS NOT NULL\n AND charge_energy_added > 0\nGROUP BY\n 1\nORDER BY\n 2 DESC\nLIMIT 3", + "rawSql": "SELECT\n round((charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric / convert_km(1, '$length_unit'), 3) * 1000 as \"efficiency_$length_unit\",\n\tcount(*) as count\nFROM\n charging_processes\nWHERE \n car_id = $car_id\n AND duration_min > 10\n AND end_battery_level <= 95\n AND start_rated_range_km IS NOT NULL\n AND end_rated_range_km IS NOT NULL\n AND charge_energy_added > 0\nGROUP BY\n 1\nORDER BY\n 2 DESC\nLIMIT 3", "refId": "A", "select": [ [ @@ -1072,6 +1170,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charges", "timeColumn": "date", "timeColumnType": "timestamp", @@ -1257,7 +1372,6 @@ "from": "now-6h", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "hidden": true, "refresh_intervals": [ @@ -1287,6 +1401,6 @@ "timezone": "", "title": "Efficiency", "uid": "fu4SiQgWz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/internal/charge-details.json b/grafana/dashboards/internal/charge-details.json index c3fe5257ee..e926b27001 100644 --- a/grafana/dashboards/internal/charge-details.json +++ b/grafana/dashboards/internal/charge-details.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.4.0" + "version": "11.2.3" }, { "type": "datasource", @@ -43,9 +43,9 @@ { "builtIn": 1, "datasource": "-- Grafana --", + "definition": "TeslaMate|U2FsdGVkX1/cEWK+8cz7pjEKXtzJnDN7b21ZDXt1MGneFGPWTLqOPtxKmu02mJPLzi/f29I+NBHd3vi0FB8R4Xn0+GtobWDgk6VAVSBTdSNniOKO8i2WPlhRaOsl2+hG7gnZ7wrf1Th2nxR7f1uYCrbwOek0IzkfLzrkjh7gkr6inT6bbDuJqrmogZajLxmAMrQ6V+/vHxBRGiwjJhgiEeq3hM1q2h04JKkNiZ8RHbsF5Cd/xd8Q9u0JVrZzIrtnhM/SFlaApU7RtRMu8CSj1llTX7WEOj6VDZAMSf+XUAanWdk725kEPN9MNu89o2zEq5P3E3cju8IbbBdPzXLV3oVuzD6/tMnxFToIIV1E/BrpF7s2RtNa8+KJJ1PF8xgs6m+/KTD2hy+WsP0636AgObRAmYg7+qotGrgNvpNPdE0EgrB7WHYlV7R/1q66bcq6tCe51X1Un70k+zo+K6AK0o4B1H6IyMlEVuRH/Fz8QVl9aYu2ztd08RbuKJlYVKpkH+pxVETAO9MclYQ90tzE6TfwDZrQZzsAlMenr4s1ZB1OlFXjLjVjnddnUilzO76cqv4yI2THQEuyQ47nuVQ4gUbx02K59vMQhns3C01JOAYokOaSXe66Y7QYdMlk09Lf|aes-256-cbc", "enable": true, "hide": true, - "definition": "TeslaMate|U2FsdGVkX1/cEWK+8cz7pjEKXtzJnDN7b21ZDXt1MGneFGPWTLqOPtxKmu02mJPLzi/f29I+NBHd3vi0FB8R4Xn0+GtobWDgk6VAVSBTdSNniOKO8i2WPlhRaOsl2+hG7gnZ7wrf1Th2nxR7f1uYCrbwOek0IzkfLzrkjh7gkr6inT6bbDuJqrmogZajLxmAMrQ6V+/vHxBRGiwjJhgiEeq3hM1q2h04JKkNiZ8RHbsF5Cd/xd8Q9u0JVrZzIrtnhM/SFlaApU7RtRMu8CSj1llTX7WEOj6VDZAMSf+XUAanWdk725kEPN9MNu89o2zEq5P3E3cju8IbbBdPzXLV3oVuzD6/tMnxFToIIV1E/BrpF7s2RtNa8+KJJ1PF8xgs6m+/KTD2hy+WsP0636AgObRAmYg7+qotGrgNvpNPdE0EgrB7WHYlV7R/1q66bcq6tCe51X1Un70k+zo+K6AK0o4B1H6IyMlEVuRH/Fz8QVl9aYu2ztd08RbuKJlYVKpkH+pxVETAO9MclYQ90tzE6TfwDZrQZzsAlMenr4s1ZB1OlFXjLjVjnddnUilzO76cqv4yI2THQEuyQ47nuVQ4gUbx02K59vMQhns3C01JOAYokOaSXe66Y7QYdMlk09Lf|aes-256-cbc", "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "target": { @@ -61,6 +61,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, + "id": null, "links": [ { "icon": "dashboard", @@ -101,6 +102,7 @@ "axisSoftMax": 100, "axisSoftMin": 0, "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -392,7 +394,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "alias": "", @@ -486,6 +487,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -497,7 +499,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -605,6 +607,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -616,7 +619,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -714,6 +717,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -725,7 +729,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -957,7 +961,7 @@ "zoom": 15 } }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1059,6 +1063,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1070,7 +1075,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1221,6 +1226,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -1233,7 +1239,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1349,6 +1355,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -1361,7 +1368,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1514,6 +1521,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1526,7 +1534,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "Real", @@ -1725,14 +1733,17 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "fillOpacity": 50, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, + "pointShape": "circle", "pointSize": { "fixed": 5 }, + "pointStrokeWidth": 1, "scaleDistribution": { "type": "linear" }, @@ -1775,6 +1786,21 @@ "value": 1 } ] + }, + { + "matcher": { + "id": "byName", + "options": "avg Power [kW]" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] } ] }, @@ -1792,27 +1818,55 @@ "placement": "bottom", "showLegend": false }, + "mapping": "manual", "series": [ { - "pointColor": {}, - "x": "SOC [%]", - "y": "Power [kW]" + "frame": { + "matcher": { + "id": "byIndex", + "options": 0 + } + }, + "x": { + "matcher": { + "id": "byName", + "options": "SOC [%]" + } + }, + "y": { + "matcher": { + "id": "byName", + "options": "Power [kW]" + } + } }, { - "pointColor": { - "fixed": "blue" + "frame": { + "matcher": { + "id": "byIndex", + "options": 1 + } + }, + "x": { + "matcher": { + "id": "byName", + "options": "avg SOC [%]" + } }, - "x": "avg SOC [%]", - "y": "avg Power [kW]" + "y": { + "matcher": { + "id": "byName", + "options": "avg Power [kW]" + } + } } ], - "seriesMapping": "manual", "tooltip": { "mode": "single", "sort": "none" } }, - "pluginVersion": "7.5.11", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1909,8 +1963,8 @@ { "current": { "selected": false, - "text": "NULL", - "value": "NULL" + "text": "330", + "value": "330" }, "hide": 2, "label": "", @@ -1922,7 +1976,7 @@ "value": "NULL" } ], - "query": "NULL", + "query": "330", "skipUrlSync": false, "type": "textbox" }, @@ -2072,6 +2126,6 @@ "timezone": "", "title": "Charge Details", "uid": "BHhxFeZRz", - "version": 3, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/internal/drive-details.json b/grafana/dashboards/internal/drive-details.json index 6b2eebd874..a2e5e4d948 100644 --- a/grafana/dashboards/internal/drive-details.json +++ b/grafana/dashboards/internal/drive-details.json @@ -17,7 +17,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -109,6 +109,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 5, "gradientMode": "opacity", @@ -617,6 +618,49 @@ "showZoom": true }, "layers": [ + { + "config": { + "showLegend": false, + "style": { + "color": { + "fixed": "transparent" + }, + "opacity": 0, + "rotation": { + "fixed": 0, + "max": 360, + "min": -360, + "mode": "mod" + }, + "size": { + "fixed": 5, + "max": 15, + "min": 2 + }, + "symbol": { + "fixed": "img/icons/marker/circle.svg", + "mode": "fixed" + }, + "symbolAlign": { + "horizontal": "center", + "vertical": "center" + }, + "textConfig": { + "fontSize": 12, + "offsetX": 0, + "offsetY": 0, + "textAlign": "center", + "textBaseline": "middle" + } + } + }, + "location": { + "mode": "auto" + }, + "name": "Temp Fix Grafana Issue #89777", + "tooltip": false, + "type": "markers" + }, { "config": { "arrow": 0, @@ -675,7 +719,7 @@ "zoom": 15 } }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -788,6 +832,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 5, "gradientMode": "opacity", @@ -951,6 +996,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 5, "gradientMode": "opacity", @@ -1222,6 +1268,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 5, "gradientMode": "opacity", @@ -1519,6 +1566,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1530,7 +1578,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1632,6 +1680,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1643,7 +1692,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1719,6 +1768,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1730,7 +1780,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1862,7 +1912,6 @@ "xTickLabelRotation": 0, "xTickLabelSpacing": 0 }, - "pluginVersion": "10.4.0", "targets": [ { "datasource": { @@ -2003,6 +2052,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -2014,7 +2064,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2087,6 +2137,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -2099,7 +2150,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2251,6 +2302,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -2262,7 +2314,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2370,6 +2422,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -2381,7 +2434,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2500,6 +2553,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -2511,7 +2565,7 @@ "textMode": "value", "wideLayout": false }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2573,7 +2627,11 @@ "templating": { "list": [ { - "current": {}, + "current": { + "selected": false, + "text": "1475", + "value": "1475" + }, "hide": 2, "name": "drive_id", "options": [ @@ -2583,7 +2641,7 @@ "value": "NULL" } ], - "query": "", + "query": "1475", "skipUrlSync": false, "type": "textbox" }, @@ -2764,6 +2822,10 @@ } ] }, + "time": { + "from": "now-12h", + "to": "now" + }, "timepicker": { "refresh_intervals": [], "time_options": [] @@ -2771,6 +2833,6 @@ "timezone": "", "title": "Drive Details", "uid": "zm7wN6Zgz", - "version": 6, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/internal/home.json b/grafana/dashboards/internal/home.json new file mode 100644 index 0000000000..f4fc189bbd --- /dev/null +++ b/grafana/dashboards/internal/home.json @@ -0,0 +1,144 @@ +{ + "__elements": {}, + "__requires": [ + { + "type": "panel", + "id": "dashlist", + "name": "Dashboard list", + "version": "" + }, + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "11.2.3" + }, + { + "type": "datasource", + "id": "grafana-postgresql-datasource", + "name": "PostgreSQL", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "news", + "name": "News", + "version": "" + }, + { + "type": "panel", + "id": "text", + "name": "Text", + "version": "" + } + ], + "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": null, + "links": [], + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "gridPos": { + "h": 20, + "w": 6, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "folderUID": "Nr4ofiDZk", + "includeVars": false, + "keepTime": false, + "maxItems": 100, + "query": "", + "showFolderNames": false, + "showHeadings": false, + "showRecentlyViewed": false, + "showSearch": true, + "showStarred": false, + "tags": [] + }, + "pluginVersion": "11.2.3", + "type": "dashlist" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "gridPos": { + "h": 20, + "w": 16, + "x": 6, + "y": 0 + }, + "id": 1, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "
", + "mode": "html" + }, + "pluginVersion": "11.2.3", + "type": "text" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "gridPos": { + "h": 20, + "w": 2, + "x": 22, + "y": 0 + }, + "id": 3, + "options": { + "feedUrl": "https://corsproxy.io/?https://github.com/teslamate-org/teslamate/tags.atom", + "showImage": false + }, + "title": "Releases", + "type": "news" + } + ], + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Home", + "uid": "be2m9kga7b8qoc", + "version": 1, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/dashboards/locations.json b/grafana/dashboards/locations.json index b1050da443..45d102174c 100644 --- a/grafana/dashboards/locations.json +++ b/grafana/dashboards/locations.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -115,6 +115,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -126,9 +127,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -154,11 +159,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Total addresses", @@ -203,6 +204,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -214,9 +216,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -242,11 +248,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Cities", @@ -291,6 +293,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -302,9 +305,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -330,11 +337,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "States", @@ -379,6 +382,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -390,9 +394,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -418,11 +426,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Countries", @@ -482,9 +486,13 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -508,11 +516,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Cities", @@ -572,9 +576,13 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -600,11 +608,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "States", @@ -701,9 +705,13 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -729,11 +737,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Last visited", @@ -967,9 +971,13 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -995,11 +1003,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Addresses", @@ -1137,9 +1141,13 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -1163,11 +1171,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Geo-fences", @@ -1260,7 +1264,6 @@ "from": "now-30d", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "hidden": true, "refresh_intervals": [ @@ -1290,6 +1293,6 @@ "timezone": "", "title": "Locations", "uid": "ZzhF-aRWz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/mileage.json b/grafana/dashboards/mileage.json index c3e50f8ff2..034691b731 100644 --- a/grafana/dashboards/mileage.json +++ b/grafana/dashboards/mileage.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -95,6 +95,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 20, "gradientMode": "opacity", @@ -200,7 +201,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "alias": "", @@ -321,7 +321,6 @@ "from": "now-6M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", diff --git a/grafana/dashboards/overview.json b/grafana/dashboards/overview.json index 567db08c80..2c4a6929a2 100644 --- a/grafana/dashboards/overview.json +++ b/grafana/dashboards/overview.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -148,7 +148,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -330,7 +330,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -417,7 +417,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -515,6 +515,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -590,7 +591,6 @@ "sort": "none" } }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -723,7 +723,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -830,7 +830,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -945,7 +945,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1066,7 +1066,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1191,7 +1191,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1313,7 +1313,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1384,6 +1384,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -1550,7 +1551,6 @@ "sort": "none" } }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1670,7 +1670,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1786,7 +1786,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1891,7 +1891,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2028,7 +2028,6 @@ "sort": "none" } }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -2222,6 +2221,6 @@ "timezone": "", "title": "Overview", "uid": "kOuP_Fggz", - "version": 14, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/projected-range.json b/grafana/dashboards/projected-range.json index af8895ab8a..e68bb4d872 100644 --- a/grafana/dashboards/projected-range.json +++ b/grafana/dashboards/projected-range.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -111,6 +111,7 @@ "axisLabel": "Projected Range", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 30, "gradientMode": "opacity", @@ -201,7 +202,6 @@ "sort": "none" } }, - "pluginVersion": "10.2.1", "targets": [ { "alias": "", @@ -288,6 +288,7 @@ "axisLabel": "Projected Range", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 30, "gradientMode": "opacity", @@ -379,7 +380,6 @@ "sort": "none" } }, - "pluginVersion": "10.2.1", "targets": [ { "alias": "", @@ -602,7 +602,6 @@ "sort": "none" } }, - "pluginVersion": "10.2.1", "targets": [ { "alias": "", @@ -867,7 +866,6 @@ "from": "now-6M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -896,6 +894,6 @@ "timezone": "", "title": "Projected Range", "uid": "riqUfXgRz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/reports/dutch-tax.json b/grafana/dashboards/reports/dutch-tax.json index 3ca8cd55e0..513fa227bb 100644 --- a/grafana/dashboards/reports/dutch-tax.json +++ b/grafana/dashboards/reports/dutch-tax.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.6+security-01" + "version": "11.2.3" }, { "type": "datasource", @@ -96,6 +96,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -348,7 +349,7 @@ } ] }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -511,7 +512,6 @@ "from": "now-1y", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -540,6 +540,6 @@ "timezone": "", "title": "Drives - Dutch tax", "uid": "lBIoQIggk", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/states.json b/grafana/dashboards/states.json index a95e36e8f6..5f042ca4c1 100644 --- a/grafana/dashboards/states.json +++ b/grafana/dashboards/states.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -125,6 +125,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -136,9 +137,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -164,11 +169,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Last state change", @@ -214,6 +215,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -225,9 +227,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -253,11 +259,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Current State", @@ -315,6 +317,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -326,9 +329,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -354,11 +361,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "parked (%)", @@ -469,6 +472,10 @@ }, "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -494,11 +501,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "States", @@ -564,7 +567,6 @@ "from": "now-2d", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", diff --git a/grafana/dashboards/statistics.json b/grafana/dashboards/statistics.json index af763d73a9..dc21b6f198 100644 --- a/grafana/dashboards/statistics.json +++ b/grafana/dashboards/statistics.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -546,15 +546,20 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "repeatDirection": "h", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\nSELECT\n duration_min > 1 AND\n distance > 1 AND\n ( \n start_position.usable_battery_level IS NULL OR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) AS is_sufficiently_precise,\n NULLIF(GREATEST(start_ideal_range_km - end_ideal_range_km, 0), 0) AS range_diff,\n date_trunc('$period', TIMEZONE('$__timezone', TIMEZONE('UTC', start_date))) as date,\n drives.*\nFROM drives\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id)\nSELECT\n EXTRACT(EPOCH FROM TIMEZONE('$__timezone', date))*1000 AS date_from,\n EXTRACT(EPOCH FROM (TIMEZONE('$__timezone', date) + ('1 ' || '$period')::INTERVAL))*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n TIMEZONE('$__timezone', date) AS date,\n sum(duration_min)*60 AS sum_duration_h, \n convert_km(max(end_km)::integer - min(start_km)::integer, '$length_unit') AS sum_distance_$length_unit,\n convert_celsius(avg(outside_temp_avg), '$temp_unit') AS avg_outside_temp_$temp_unit,\n count(*) AS cnt,\n sum(distance)/sum(range_diff) AS efficiency\nFROM data WHERE\n car_id = $car_id AND\n $__timeFilter(start_date)\nGROUP BY date\nORDER BY date", + "rawSql": "WITH data AS (\nSELECT\n duration_min > 1 AND\n distance > 1 AND\n ( \n start_position.usable_battery_level IS NULL OR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) AS is_sufficiently_precise,\n NULLIF(GREATEST(start_ideal_range_km - end_ideal_range_km, 0), 0) AS range_diff,\n date_trunc('$period', TIMEZONE('UTC', start_date)) as date,\n drives.*\nFROM drives\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id)\nSELECT\n EXTRACT(EPOCH FROM date)*1000 AS date_from,\n EXTRACT(EPOCH FROM date + interval '1 $period')*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n date,\n sum(duration_min)*60 AS sum_duration_h, \n convert_km(max(end_km)::integer - min(start_km)::integer, '$length_unit') AS sum_distance_$length_unit,\n convert_celsius(avg(outside_temp_avg), '$temp_unit') AS avg_outside_temp_$temp_unit,\n count(*) AS cnt,\n sum(distance)/sum(range_diff) AS efficiency\nFROM data WHERE\n car_id = $car_id AND\n $__timeFilter(start_date)\nGROUP BY date\nORDER BY date", "refId": "A", "select": [ [ @@ -566,6 +571,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -575,18 +597,19 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n charging_processes.*,\n \tdate_trunc('$period', TIMEZONE('$__timezone', TIMEZONE('UTC', start_date))) as date\n FROM charging_processes)\nSELECT\n EXTRACT(EPOCH FROM TIMEZONE('$__timezone', date))*1000 AS date_from,\n EXTRACT(EPOCH FROM (TIMEZONE('$__timezone', date) + ('1 ' || '$period')::INTERVAL))*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n TIMEZONE('$__timezone', date) AS date,\n sum(greatest(charge_energy_added,charge_energy_used)) AS sum_consumption_kwh,\n sum(greatest(charge_energy_added,charge_energy_used)) / count(*) AS avg_consumption_kwh,\n sum(cost) AS cost_charges,\n count(*) AS cnt_charges\nFROM data WHERE\n car_id = $car_id AND\n $__timeFilter(start_date) AND\n (charge_energy_added IS NULL OR charge_energy_added > 0.1)\nGROUP BY date\nORDER BY date", + "rawSql": "WITH data AS (\n SELECT\n charging_processes.*,\n \tdate_trunc('$period', TIMEZONE('UTC', start_date)) as date\n FROM charging_processes)\nSELECT\n EXTRACT(EPOCH FROM date)*1000 AS date_from,\n EXTRACT(EPOCH FROM date + interval '1 $period')*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n date,\n sum(greatest(charge_energy_added,charge_energy_used)) AS sum_consumption_kwh,\n sum(greatest(charge_energy_added,charge_energy_used)) / count(*) AS avg_consumption_kwh,\n sum(cost) AS cost_charges,\n count(*) AS cnt_charges\nFROM data WHERE\n car_id = $car_id AND\n $__timeFilter(start_date) AND\n (charge_energy_added IS NULL OR charge_energy_added > 0.1)\nGROUP BY date\nORDER BY date", "refId": "B", "select": [ [ @@ -598,6 +621,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -605,19 +645,20 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, + "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n drives.*,\n date_trunc('$period', TIMEZONE('$__timezone', TIMEZONE('UTC', start_date))) as date\n FROM drives)\nSELECT\n EXTRACT(EPOCH FROM TIMEZONE('$__timezone', date))*1000 AS date_from,\n EXTRACT(EPOCH FROM (TIMEZONE('$__timezone', date) + ('1 ' || '$period')::INTERVAL))*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n TIMEZONE('$__timezone', date) AS date,\n sum(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0) * car.efficiency * 1000) / \n convert_km(sum(distance)::numeric, '$length_unit') as efficiency_net_$length_unit\nFROM data\nJOIN cars car ON car.id = car_id\nWHERE\n car_id = $car_id AND\n $__timeFilter(start_date)\nGROUP BY date\nORDER BY date", + "rawSql": "WITH data AS (\n SELECT\n drives.*,\n date_trunc('$period', TIMEZONE('UTC', start_date)) as date\n FROM drives)\nSELECT\n EXTRACT(EPOCH FROM date)*1000 AS date_from,\n EXTRACT(EPOCH FROM date + interval '1 $period')*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n date,\n sum(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0) * car.efficiency * 1000) / \n convert_km(sum(distance)::numeric, '$length_unit') as efficiency_net_$length_unit\nFROM data\nJOIN cars car ON car.id = car_id\nWHERE\n car_id = $car_id AND\n $__timeFilter(start_date)\nGROUP BY date\nORDER BY date", "refId": "C", "select": [ [ @@ -629,6 +670,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -636,11 +694,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "per ${period}", @@ -994,7 +1048,6 @@ "from": "now-10y", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", diff --git a/grafana/dashboards/timeline.json b/grafana/dashboards/timeline.json index 7ba3344b12..ff667c91f1 100644 --- a/grafana/dashboards/timeline.json +++ b/grafana/dashboards/timeline.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -567,7 +567,7 @@ } ] }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -877,6 +877,6 @@ "timezone": "", "title": "Timeline", "uid": "SUBgwtigz", - "version": 6, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/trip.json b/grafana/dashboards/trip.json index 6cdc22d772..79f409454c 100644 --- a/grafana/dashboards/trip.json +++ b/grafana/dashboards/trip.json @@ -17,7 +17,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -87,7 +87,7 @@ "targetBlank": true, "title": "Select last three drives", "type": "link", - "url": "/d/FkUpJpQZk?from=$from" + "url": "/d/FkUpJpQZk/trip?from=$from" }, { "icon": "dashboard", @@ -177,6 +177,49 @@ "showZoom": true }, "layers": [ + { + "config": { + "showLegend": false, + "style": { + "color": { + "fixed": "transparent" + }, + "opacity": 0, + "rotation": { + "fixed": 0, + "max": 360, + "min": -360, + "mode": "mod" + }, + "size": { + "fixed": 5, + "max": 15, + "min": 2 + }, + "symbol": { + "fixed": "img/icons/marker/circle.svg", + "mode": "fixed" + }, + "symbolAlign": { + "horizontal": "center", + "vertical": "center" + }, + "textConfig": { + "fontSize": 12, + "offsetX": 0, + "offsetY": 0, + "textAlign": "center", + "textBaseline": "middle" + } + } + }, + "location": { + "mode": "auto" + }, + "name": "Temp Fix Grafana Issue #89777", + "tooltip": false, + "type": "markers" + }, { "config": { "arrow": 0, @@ -230,7 +273,7 @@ "zoom": 15 } }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -358,6 +401,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -369,9 +413,13 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -397,11 +445,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -513,6 +557,10 @@ }, "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -538,13 +586,13 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -570,11 +618,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "piechart" @@ -662,6 +706,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -673,9 +718,13 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -701,11 +750,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -782,6 +827,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -793,9 +839,13 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -821,11 +871,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -904,6 +950,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -916,9 +963,13 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -944,11 +995,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -1027,6 +1074,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -1038,9 +1086,13 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -1066,11 +1118,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -1126,6 +1174,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -1137,9 +1186,13 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -1165,11 +1218,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -1232,9 +1281,13 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -1260,13 +1313,13 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, "format": "table", "group": [], "hide": false, @@ -1293,11 +1346,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "bargauge" @@ -1407,6 +1456,10 @@ }, "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -1432,11 +1485,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "transparent": true, @@ -1498,7 +1547,7 @@ { "targetBlank": false, "title": "View drive details", - "url": "d/zm7wN6Zgz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-drive_id=${__data.fields.drive_id.numeric}" + "url": "d/zm7wN6Zgz/drive-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-drive_id=${__data.fields.drive_id.numeric}" } ] }, @@ -1786,7 +1835,7 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1794,11 +1843,12 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n car.id as car_id,\n CASE WHEN start_geofence.id IS NULL THEN CONCAT('new?lat=', start_position.latitude, '&lng=', start_position.longitude)\n WHEN start_geofence.id IS NOT NULL THEN CONCAT(start_geofence.id, '/edit')\n END as start_path,\n CASE WHEN end_geofence.id IS NULL THEN CONCAT('new?lat=', end_position.latitude, '&lng=', end_position.longitude)\n WHEN end_geofence.id IS NOT NULL THEN CONCAT(end_geofence.id, '/edit')\n END as end_path,\n TO_CHAR((duration_min * INTERVAL '1 minute'), 'HH24:MI') as duration_str,\n drives.id as drive_id,\n -- Columns\n start_date,\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS start_address,\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS end_address,\n duration_min,\n distance,\n start_position.usable_battery_level as start_usable_battery_level,\n start_position.battery_level as start_battery_level,\n end_position.usable_battery_level as end_usable_battery_level,\n end_position.battery_level as end_battery_level,\n start_position.battery_level != start_position.usable_battery_level OR end_position.battery_level != end_position.usable_battery_level as reduced_range,\n duration_min > 1 AND distance > 1 AND ( \n start_position.usable_battery_level IS NULL OR end_position.usable_battery_level IS NULL\tOR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) as is_sufficiently_precise,\n NULLIF(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0), 0) as range_diff,\n car.efficiency as car_efficiency,\n outside_temp_avg,\n distance / NULLIF(duration_min, 0) * 60 AS avg_speed\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id\n ORDER BY start_date DESC\n)\nSELECT\n start_date_ts,\n end_date_ts,\n car_id,\n start_path,\n end_path,\n duration_str,\n drive_id,\n -- Columns\n start_date,\n start_address,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n start_battery_level as \"% Start\",\n end_battery_level as \"% End\",\n CASE WHEN is_sufficiently_precise THEN range_diff * car_efficiency / distance * 1000 * CASE WHEN '$length_unit' = 'km' THEN 1\n WHEN '$length_unit' = 'mi' THEN 1.60934\n END\n END AS consumption_kWh_$length_unit\nFROM data;", + "rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n car.id as car_id,\n CASE WHEN start_geofence.id IS NULL THEN CONCAT('new?lat=', start_position.latitude, '&lng=', start_position.longitude)\n WHEN start_geofence.id IS NOT NULL THEN CONCAT(start_geofence.id, '/edit')\n END as start_path,\n CASE WHEN end_geofence.id IS NULL THEN CONCAT('new?lat=', end_position.latitude, '&lng=', end_position.longitude)\n WHEN end_geofence.id IS NOT NULL THEN CONCAT(end_geofence.id, '/edit')\n END as end_path,\n TO_CHAR((duration_min * INTERVAL '1 minute'), 'HH24:MI') as duration_str,\n drives.id as drive_id,\n -- Columns\n start_date,\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS start_address,\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS end_address,\n duration_min,\n distance,\n start_position.usable_battery_level as start_usable_battery_level,\n start_position.battery_level as start_battery_level,\n end_position.usable_battery_level as end_usable_battery_level,\n end_position.battery_level as end_battery_level,\n start_position.battery_level != start_position.usable_battery_level OR end_position.battery_level != end_position.usable_battery_level as reduced_range,\n duration_min > 1 AND distance > 1 AND ( \n start_position.usable_battery_level IS NULL OR end_position.usable_battery_level IS NULL\tOR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) as is_sufficiently_precise,\n NULLIF(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0), 0) as range_diff,\n car.efficiency as car_efficiency,\n outside_temp_avg,\n distance / NULLIF(duration_min, 0) * 60 AS avg_speed\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id\n ORDER BY start_date DESC\n)\nSELECT\n start_date_ts,\n end_date_ts,\n car_id,\n start_path,\n end_path,\n duration_str,\n drive_id,\n -- Columns\n start_date,\n start_address,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n start_battery_level as \"% Start\",\n end_battery_level as \"% End\",\n CASE WHEN is_sufficiently_precise THEN range_diff * car_efficiency / convert_km(distance::numeric, '$length_unit') * 1000\n END AS consumption_kWh_$length_unit\nFROM data;", "refId": "A", "select": [ [ @@ -1810,6 +1860,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -1878,7 +1945,7 @@ { "targetBlank": false, "title": "View charge details", - "url": "d/BHhxFeZRz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric:raw}" + "url": "d/BHhxFeZRz/charge-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric:raw}" } ] }, @@ -2272,7 +2339,9 @@ }, "id": 36, "options": { + "cellHeight": "sm", "footer": { + "countRows": false, "fields": "", "reducer": [ "sum" @@ -2287,7 +2356,7 @@ } ] }, - "pluginVersion": "8.5.4", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2342,9 +2411,13 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -2353,6 +2426,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2475,7 +2549,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "datasource": { @@ -2524,9 +2597,13 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -2535,6 +2612,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2635,7 +2713,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "datasource": { @@ -2844,10 +2921,9 @@ ] }, "time": { - "from": "now/d", + "from": "2024-11-02T13:34:36.487Z", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -2876,6 +2952,6 @@ "timezone": "", "title": "Trip", "uid": "FkUpJpQZk", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/updates.json b/grafana/dashboards/updates.json index aefce9b4e2..68ad623e8b 100644 --- a/grafana/dashboards/updates.json +++ b/grafana/dashboards/updates.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -129,9 +129,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -157,11 +161,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Updates", @@ -213,9 +213,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -241,11 +245,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Median time between updates", @@ -511,7 +511,7 @@ } ] }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "scroll": true, "showHeader": true, "sort": { @@ -626,7 +626,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "with u as (\r\n select *, coalesce(lag(start_date) over(order by start_date desc), now()) as next_start_date \r\n from updates\r\n where car_id = $car_id and $__timeFilter(start_date)\r\n),\r\nrng as (\r\n SELECT\r\n\t date_trunc('hour', date) AS date,\r\n\t (sum(${preferred_range}_battery_range_km)/ nullif(sum(usable_battery_level),0) * 100 ) AS \"battery_rng\",\r\n\t sum(case when action = 'Charge' then 1 else 0 end) as chg_ct\r\n FROM (\r\n select coalesce(usable_battery_level, battery_level) as usable_battery_level, start_date as date, start_rated_range_km as rated_battery_range_km, start_ideal_range_km as ideal_battery_range_km, 'Drive' as action\r\n from drives d\r\n inner join positions p on d.start_position_id = p.id \r\n where d.car_id = $car_id and $__timeFilter(start_date)\r\n union all\r\n select end_battery_level as usable_battery_level, end_date, end_rated_range_km as rated_battery_range_km, end_ideal_range_km as ideal_battery_range_km, 'Charge' as action\r\n from charging_processes p\r\n where $__timeFilter(end_date) and p.car_id = $car_id\r\n ) as data\r\n GROUP BY 1\r\n)\r\n\r\nselect\t\r\n u.start_date as time,\r\n\textract(EPOCH FROM u.end_date - u.start_date) AS update_duration,\r\n\tage(date(u.start_date), date(lag(u.start_date) OVER (ORDER BY u.start_date))) AS since_last_update,\r\n\tsplit_part(u.version, ' ', 1) as version,\r\n\tsum(r.chg_ct) as chg_ct,\r\n\tconvert_km(avg(r.battery_rng), '$length_unit')::numeric(6,2) AS avg_${preferred_range}_range_${length_unit}\r\nfrom u u\r\nleft join rng r\r\n\tON r.date between u.start_date and u.next_start_date\r\ngroup by u.car_id,\r\n\tu.start_date,\r\n\tu.end_date,\r\n\tnext_start_date,\r\n\tsplit_part(u.version, ' ', 1)", + "rawSql": "with u as (\r\n select *, coalesce(lag(start_date) over(order by start_date desc), now()) as next_start_date \r\n from updates\r\n where car_id = $car_id and $__timeFilter(start_date)\r\n),\r\nrng as (\r\n SELECT\r\n\t date_trunc('hour', TIMEZONE('UTC', date)) AS date,\r\n\t (sum(${preferred_range}_battery_range_km)/ nullif(sum(usable_battery_level),0) * 100 ) AS \"battery_rng\",\r\n\t sum(case when action = 'Charge' then 1 else 0 end) as chg_ct\r\n FROM (\r\n select coalesce(usable_battery_level, battery_level) as usable_battery_level, start_date as date, start_rated_range_km as rated_battery_range_km, start_ideal_range_km as ideal_battery_range_km, 'Drive' as action\r\n from drives d\r\n inner join positions p on d.start_position_id = p.id \r\n where d.car_id = $car_id and $__timeFilter(start_date)\r\n union all\r\n select end_battery_level as usable_battery_level, end_date, end_rated_range_km as rated_battery_range_km, end_ideal_range_km as ideal_battery_range_km, 'Charge' as action\r\n from charging_processes p\r\n where $__timeFilter(end_date) and p.car_id = $car_id\r\n ) as data\r\n GROUP BY 1\r\n)\r\n\r\nselect\t\r\n u.start_date as time,\r\n\textract(EPOCH FROM u.end_date - u.start_date) AS update_duration,\r\n\tage(date(u.start_date), date(lag(u.start_date) OVER (ORDER BY u.start_date))) AS since_last_update,\r\n\tsplit_part(u.version, ' ', 1) as version,\r\n\tsum(r.chg_ct) as chg_ct,\r\n\tconvert_km(avg(r.battery_rng), '$length_unit')::numeric(6,2) AS avg_${preferred_range}_range_${length_unit}\r\nfrom u u\r\nleft join rng r\r\n\tON r.date between u.start_date and u.next_start_date\r\ngroup by u.car_id,\r\n\tu.start_date,\r\n\tu.end_date,\r\n\tnext_start_date,\r\n\tsplit_part(u.version, ' ', 1)", "refId": "A", "select": [ [ @@ -800,6 +800,6 @@ "timezone": "", "title": "Updates", "uid": "IiC07mgWz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/vampire-drain.json b/grafana/dashboards/vampire-drain.json index a81ad82735..4d227ecd61 100644 --- a/grafana/dashboards/vampire-drain.json +++ b/grafana/dashboards/vampire-drain.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -132,7 +132,7 @@ { "targetBlank": false, "title": "", - "url": "d/zm7wN6Zgz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}" + "url": "d/zm7wN6Zgz/drive-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}" } ] }, @@ -548,7 +548,7 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -749,7 +749,6 @@ "from": "now-90d", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", diff --git a/grafana/dashboards/visited.json b/grafana/dashboards/visited.json index dd23b5192e..9dbad9d4c8 100644 --- a/grafana/dashboards/visited.json +++ b/grafana/dashboards/visited.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -129,11 +129,9 @@ "maxDataPoints": 10000000, "options": { "basemap": { - "config": { - "server": "streets" - }, + "config": {}, "name": "Layer 0", - "type": "esri-xyz" + "type": "osm-standard" }, "controls": { "mouseWheelZoom": true, @@ -144,6 +142,49 @@ "showZoom": true }, "layers": [ + { + "config": { + "showLegend": false, + "style": { + "color": { + "fixed": "transparent" + }, + "opacity": 0, + "rotation": { + "fixed": 0, + "max": 360, + "min": -360, + "mode": "mod" + }, + "size": { + "fixed": 5, + "max": 15, + "min": 2 + }, + "symbol": { + "fixed": "img/icons/marker/circle.svg", + "mode": "fixed" + }, + "symbolAlign": { + "horizontal": "center", + "vertical": "center" + }, + "textConfig": { + "fontSize": 12, + "offsetX": 0, + "offsetY": 0, + "textAlign": "center", + "textBaseline": "middle" + } + } + }, + "location": { + "mode": "auto" + }, + "name": "Temp Fix Grafana Issue #89777", + "tooltip": false, + "type": "markers" + }, { "config": { "arrow": 0, @@ -202,7 +243,7 @@ "zoom": 15 } }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -213,7 +254,7 @@ "format": "table", "hide": false, "rawQuery": true, - "rawSql": "SELECT\n date_trunc('minute', date) as time,\n avg(latitude) as latitude,\n avg(longitude) as longitude\nFROM\n positions\nWHERE\n car_id = $car_id AND $__timeFilter(date) and ideal_battery_range_km is not null\nGROUP BY 1\nORDER BY 1", + "rawSql": "SELECT\n date_trunc('minute', TIMEZONE('UTC', date)) as time,\n avg(latitude) as latitude,\n avg(longitude) as longitude\nFROM\n positions\nWHERE\n car_id = $car_id AND $__timeFilter(date) and ideal_battery_range_km is not null\nGROUP BY 1\nORDER BY 1", "refId": "Positions", "sql": { "columns": [ @@ -271,6 +312,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -282,7 +324,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -417,6 +459,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -428,7 +471,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -593,6 +636,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -604,7 +648,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -766,6 +810,6 @@ "timezone": "", "title": "Visited", "uid": "RG_DxSmgk", - "version": 5, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/nix/module.nix b/nix/module.nix index d62aab6bca..cf2495d137 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -245,14 +245,17 @@ in }; security = { allow_embedding = true; - disable_gravatr = true; + disable_gravatar = true; }; users = { allow_sign_up = false; + default_language = "detect"; }; "auth.anonymous".enabled = false; "auth.basic".enabled = false; analytics.reporting_enabled = false; + dashboards.default_home_dashboard_path = "../grafana/dashboards/internal/home.json"; + date_formats.use_browser_locale = true; }; provision = { enable = true; @@ -269,7 +272,7 @@ in folderUid = "Nr4ofiDZk"; type = "file"; disableDeletion = false; - editable = true; + allowUiUpdates = true; updateIntervalSeconds = 86400; options.path = lib.sources.sourceFilesBySuffices ../grafana/dashboards @@ -282,7 +285,7 @@ in folderUid = "Nr5ofiDZk"; type = "file"; disableDeletion = false; - editable = true; + allowUiUpdates = true; updateIntervalSeconds = 86400; options.path = lib.sources.sourceFilesBySuffices ../grafana/dashboards/internal @@ -295,7 +298,7 @@ in folderUid = "Nr6ofiDZk"; type = "file"; disableDeletion = false; - editable = true; + allowUiUpdates = true; updateIntervalSeconds = 86400; options.path = lib.sources.sourceFilesBySuffices ../grafana/dashboards/reports diff --git a/website/docs/installation/debian.md b/website/docs/installation/debian.md index 9dc6657361..be34ebde03 100644 --- a/website/docs/installation/debian.md +++ b/website/docs/installation/debian.md @@ -37,7 +37,7 @@ Source: [elixir-lang.org/install](https://elixir-lang.org/install)