From add66b0a6af8fbb79cd846cd23a81a0bf890e323 Mon Sep 17 00:00:00 2001 From: Jamie Date: Wed, 22 May 2024 03:12:13 -0400 Subject: [PATCH] fix(teslamate) fix questions and minor updates (#22330) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Attempts to fix the issue with questions.yml container image and dashboard updates ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [x] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [x] ⚖️ My code follows the style guidelines of this project - [x] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [x] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [x] ⬆️ I increased versions for any altered app according to semantic versioning - [x] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):` or `chore(chart-name):` **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- charts/incubator/teslamate/Chart.yaml | 4 +- .../dashboards/teslamate/battery-health.json | 293 +- .../dashboards/teslamate/charges.json | 243 +- .../teslamate/charging-stats-lfp.json | 409 ++- .../dashboards/teslamate/charging-stats.json | 373 ++- .../teslamate/internal/charge-details.json | 1075 ++++++- .../teslamate/internal/drive-details.json | 2246 +++++++++------ .../teslamate/reports/dutch-tax.json | 24 +- .../dashboards/teslamate1/statistics.json | 72 +- .../dashboards/teslamate1/visited.json | 468 +++- .../dashboards/teslamate2/BatteryHealth.json | 6 +- .../dashboards/teslamate2/BrowseCharges.json | 143 +- .../teslamate2/ChargingCostsStats.json | 69 +- .../teslamate2/ContinuousTrips.json | 49 +- .../teslamate2/CurrentChargeView.json | 976 +++++-- .../teslamate2/CurrentDriveView.json | 2459 ++++++++++------- .../dashboards/teslamate2/CurrentState.json | 337 ++- .../teslamate2/DCChargingCurvesByCarrier.json | 208 +- .../teslamate2/DatabaseDashboadInfo.json | 2 +- .../dashboards/teslamate2/MileageStats.json | 55 +- .../dashboards/teslamate2/TrackingDrives.json | 361 +-- charts/incubator/teslamate/questions.yaml | 87 +- charts/incubator/teslamate/values.yaml | 2 +- 23 files changed, 6767 insertions(+), 3194 deletions(-) diff --git a/charts/incubator/teslamate/Chart.yaml b/charts/incubator/teslamate/Chart.yaml index 539c5726739..22a22822e51 100644 --- a/charts/incubator/teslamate/Chart.yaml +++ b/charts/incubator/teslamate/Chart.yaml @@ -30,11 +30,11 @@ maintainers: - name: TrueCharts email: info@truecharts.org url: https://truecharts.org -name: TeslaMate +name: teslamate sources: - https://github.com/teslamate-org/teslamate - https://docs.teslamate.org/docs/installation/docker - https://github.com/truecharts/charts/tree/master/charts/incubator/TeslaMate - https://hub.docker.com/r/teslamate/teslamate type: application -version: 1.0.4 +version: 1.0.5 diff --git a/charts/incubator/teslamate/dashboards/teslamate/battery-health.json b/charts/incubator/teslamate/dashboards/teslamate/battery-health.json index 9db33cbfcf4..b559275bd77 100644 --- a/charts/incubator/teslamate/dashboards/teslamate/battery-health.json +++ b/charts/incubator/teslamate/dashboards/teslamate/battery-health.json @@ -52,6 +52,7 @@ "type": "grafana", "uid": "-- 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, "iconColor": "rgba(0, 211, 255, 1)", @@ -353,7 +354,7 @@ "x": 12, "y": 0 }, - "id": 32, + "id": 37, "options": { "colorMode": "value", "graphMode": "none", @@ -410,7 +411,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT ROUND(convert_km((max(odometer) - min(odometer))::numeric, '$length_unit'),0)|| ' $length_unit' as \"Mileage\"\nfrom positions where car_id = $car_id;", + "rawSql": "SELECT ROUND(convert_km((max(end_km) - min(start_km))::numeric, '$length_unit'),0)|| ' $length_unit' as \"Mileage\"\nFROM drives WHERE car_id = $car_id;", "refId": "Mileage", "select": [ [ @@ -453,12 +454,13 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "select ROUND(convert_km(ROUND(odometer::numeric,0), '$length_unit'),0) || ' $length_unit' as \"Odometer\"\nfrom positions \nwhere car_id = $car_id\norder by date desc \nlimit 1;", + "rawSql": "SELECT ROUND(convert_km(max(end_km)::numeric, '$length_unit'),0) || ' $length_unit' as \"Odometer\"\nFROM drives WHERE car_id = $car_id;", "refId": "Odometer", "select": [ [ @@ -468,6 +470,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "cars", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -894,6 +913,84 @@ }, "pluginVersion": "10.4.0", "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\r\n\tCOUNT(*) AS \"Total charges\"\r\nFROM\r\n\tcharging_processes\r\nWHERE\r\n\tcar_id = $car_id AND charge_energy_added > 0.01\r\n\t", + "refId": "Total charges", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n\tfloor(sum(charge_energy_added) / CASE WHEN $custom_kwh_new > 0 THEN $custom_kwh_new ELSE ('$aux'::json -> 'MaxCapacity')::text::float END) AS \"Charging cycles\"\nFROM charging_processes WHERE car_id = $car_id AND charge_energy_added > 0.01", + "refId": "Charging cycles", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, { "datasource": { "type": "grafana-postgresql-datasource", @@ -971,84 +1068,6 @@ "limit": 50 } }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - }, - "editorMode": "code", - "format": "table", - "hide": false, - "rawQuery": true, - "rawSql": "SELECT\r\n\tCOUNT(*) AS \"Total charges\"\r\nFROM\r\n\tcharging_processes\r\nWHERE\r\n\tcar_id = $car_id AND charge_energy_added > 0.01\r\n\t", - "refId": "Total charges", - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - } - }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - }, - "editorMode": "code", - "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT\n\tfloor(sum(charge_energy_added) / CASE WHEN $custom_kwh_new > 0 THEN $custom_kwh_new ELSE ('$aux'::json -> 'MaxCapacity')::text::float END) AS \"Charging cycles\"\nFROM charging_processes WHERE car_id = $car_id AND charge_energy_added > 0.01", - "refId": "Charging cycles", - "select": [ - [ - { - "params": ["start_km"], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "table": "drives", - "timeColumn": "start_date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - }, { "datasource": { "type": "grafana-postgresql-datasource", @@ -1123,7 +1142,7 @@ }, "gridPos": { "h": 2, - "w": 6, + "w": 4, "x": 6, "y": 9 }, @@ -1195,6 +1214,112 @@ "title": "Current SOC", "type": "bargauge" }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "This is the Derived Rated Efficiency that TeslaMate calculates based on battery charges. \nThis information can be seen in more detail on the \"Efficiency\" dashboard.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 0, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_km/" + }, + "properties": [ + { + "id": "unit", + "value": "Wh/km" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*_mi/" + }, + "properties": [ + { + "id": "unit", + "value": "Wh/mi" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 2, + "x": 10, + "y": 9 + }, + "id": 32, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "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", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Efficiency", + "type": "stat" + }, { "datasource": { "type": "grafana-postgresql-datasource", @@ -1236,7 +1361,7 @@ }, "gridPos": { "h": 2, - "w": 6, + "w": 4, "x": 6, "y": 11 }, @@ -1699,6 +1824,6 @@ "timezone": "browser", "title": "Battery Health", "uid": "jchmRiqUfXgTM", - "version": 16, + "version": 18, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate/charges.json b/charts/incubator/teslamate/dashboards/teslamate/charges.json index 46d4456da3c..99816481fab 100644 --- a/charts/incubator/teslamate/dashboards/teslamate/charges.json +++ b/charts/incubator/teslamate/dashboards/teslamate/charges.json @@ -1,9 +1,37 @@ { + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "10.4.0" + }, + { + "type": "datasource", + "id": "grafana-postgresql-datasource", + "name": "PostgreSQL", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + } + ], "annotations": { "list": [ { "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, "iconColor": "rgba(0, 211, 255, 1)", @@ -21,7 +49,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "iteration": 1642763869363, + "id": null, "links": [ { "icon": "dashboard", @@ -56,6 +84,10 @@ "type": "row" }, { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "fieldConfig": { "defaults": { "color": { @@ -63,7 +95,10 @@ }, "custom": { "align": "auto", - "displayMode": "auto" + "cellOptions": { + "type": "auto" + }, + "inspect": false }, "decimals": 2, "displayName": "", @@ -244,8 +279,10 @@ "value": 1 }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { "id": "custom.align" @@ -446,8 +483,10 @@ "value": 1 }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { "id": "custom.align" @@ -529,6 +568,32 @@ { "id": "custom.width", "value": 80 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue", + "value": null + }, + { + "color": "super-light-green", + "value": 50 + }, + { + "color": "super-light-red", + "value": 68 + } + ] + } } ] }, @@ -571,14 +636,18 @@ }, { "id": "unit", - "value": "none" + "value": "lengthmi" }, { "id": "custom.align" }, { "id": "custom.width", - "value": 100 + "value": 80 + }, + { + "id": "decimals", + "value": 0 } ] }, @@ -784,9 +853,10 @@ "y": 1 }, "id": 6, - "links": [], "options": { + "cellHeight": "sm", "footer": { + "countRows": false, "fields": "", "reducer": ["sum"], "show": false @@ -799,10 +869,14 @@ } ] }, - "pluginVersion": "8.3.4", + "pluginVersion": "10.4.0", "targets": [ { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", @@ -817,6 +891,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -827,7 +918,6 @@ ] } ], - "datasource": "TeslaMate", "title": "Charges", "transformations": [ { @@ -840,7 +930,10 @@ "type": "table" }, { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "fieldConfig": { "defaults": { "color": { @@ -875,13 +968,12 @@ "overrides": [] }, "gridPos": { - "h": 2, - "w": 8, + "h": 4, + "w": 6, "x": 0, "y": 20 }, "id": 10, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -893,9 +985,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "10.4.0", "targets": [ { "format": "time_series", @@ -921,7 +1015,11 @@ "params": [], "type": "macro" } - ] + ], + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + } } ], "title": "Energy added", @@ -929,7 +1027,10 @@ "type": "stat" }, { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "fieldConfig": { "defaults": { "color": { @@ -964,13 +1065,12 @@ "overrides": [] }, "gridPos": { - "h": 2, - "w": 8, - "x": 8, + "h": 4, + "w": 6, + "x": 6, "y": 20 }, "id": 12, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -982,9 +1082,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "10.4.0", "targets": [ { "format": "time_series", @@ -1010,7 +1112,11 @@ "params": [], "type": "macro" } - ] + ], + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + } } ], "title": "Energy used", @@ -1018,7 +1124,10 @@ "type": "stat" }, { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "fieldConfig": { "defaults": { "color": { @@ -1054,13 +1163,12 @@ "overrides": [] }, "gridPos": { - "h": 2, - "w": 8, - "x": 16, + "h": 4, + "w": 5, + "x": 12, "y": 20 }, "id": 13, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -1072,9 +1180,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "10.4.0", "targets": [ { "format": "time_series", @@ -1100,7 +1210,11 @@ "params": [], "type": "macro" } - ] + ], + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + } } ], "title": "Cost", @@ -1108,18 +1222,16 @@ "type": "stat" } ], - "schemaVersion": 36, - "style": "dark", + "schemaVersion": 39, "tags": ["tesla"], "templating": { "list": [ { - "current": { - "selected": false, - "text": "All", - "value": "$__all" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", "hide": 2, "includeAll": true, @@ -1138,12 +1250,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "km", - "value": "km" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select unit_of_length from settings limit 1;", "hide": 2, "includeAll": false, @@ -1162,12 +1273,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "C", - "value": "C" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select unit_of_temperature from settings limit 1;", "hide": 2, "includeAll": false, @@ -1186,12 +1296,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "ideal", - "value": "ideal" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select preferred_range from settings limit 1;", "hide": 2, "includeAll": false, @@ -1209,12 +1318,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "http://localhost:4000", - "value": "http://localhost:4000" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select base_url from settings limit 1;", "hide": 2, "includeAll": false, @@ -1233,12 +1341,11 @@ }, { "allValue": "-1", - "current": { - "selected": false, - "text": ["All"], - "value": ["$__all"] + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "SELECT name AS __text, id AS __value FROM geofences ORDER BY name COLLATE \"C\" ASC;", "hide": 0, "includeAll": true, @@ -1330,6 +1437,6 @@ "timezone": "", "title": "Charges", "uid": "TSmNYvRRk", - "version": 4, + "version": 5, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate/charging-stats-lfp.json b/charts/incubator/teslamate/dashboards/teslamate/charging-stats-lfp.json index 90364ab8931..5bc84ffc9ed 100644 --- a/charts/incubator/teslamate/dashboards/teslamate/charging-stats-lfp.json +++ b/charts/incubator/teslamate/dashboards/teslamate/charging-stats-lfp.json @@ -22,7 +22,6 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 1, - "iteration": 1658137661652, "links": [ { "icon": "dashboard", @@ -82,7 +81,6 @@ "y": 1 }, "id": 8, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -97,9 +95,11 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "format": "table", @@ -156,7 +156,6 @@ "y": 1 }, "id": 10, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -171,9 +170,11 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "format": "table", @@ -226,12 +227,11 @@ }, "gridPos": { "h": 3, - "w": 4, + "w": 3, "x": 10, "y": 1 }, "id": 14, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -246,9 +246,11 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "datasource": "TeslaMate", @@ -302,12 +304,11 @@ }, "gridPos": { "h": 3, - "w": 4, - "x": 14, + "w": 3, + "x": 13, "y": 1 }, "id": 27, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -322,11 +323,15 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { + "datasource": "TeslaMate", + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", @@ -341,6 +346,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -377,8 +399,8 @@ }, "gridPos": { "h": 3, - "w": 3, - "x": 18, + "w": 2, + "x": 16, "y": 1 }, "id": 26, @@ -392,9 +414,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "format": "table", @@ -449,8 +473,8 @@ }, "gridPos": { "h": 3, - "w": 3, - "x": 21, + "w": 2, + "x": 18, "y": 1 }, "id": 31, @@ -464,17 +488,38 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { + "datasource": "TeslaMate", + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT (\n SELECT sum(cost)\n FROM charging_processes\n WHERE $__timeFilter(end_date) AND car_id = $car_id\n) / (\n SELECT sum(greatest(charge_energy_added, charge_energy_used))\n FROM charging_processes\n WHERE $__timeFilter(end_date) AND car_id = $car_id\n)", "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -490,6 +535,177 @@ "title": "Average Cost per kWh", "type": "stat" }, + { + "datasource": "TeslaMate", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#d8d9da", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 2, + "x": 20, + "y": 1 + }, + "id": 33, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": "TeslaMate", + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "WITH data AS (\n SELECT\n\t\tcp.id,\n cp.cost,\n cp.end_date,\n cp.car_id,\n cp.charge_energy_added,\n cp.charge_energy_used,\n\t\tCASE WHEN NULLIF(mode() within group (order by charger_phases),0) is null THEN 'DC'\n\t\t\t\t ELSE 'AC'\n\t\tEND AS current\n\tFROM charging_processes cp\n RIGHT JOIN charges ON cp.id = charges.charging_process_id\n WHERE\n\t cp.car_id = $car_id\n\t AND $__timeFilter(end_date)\n GROUP BY 1\n)\nSELECT (\n SELECT \n sum(cost)\n FROM data\n WHERE $__timeFilter(end_date) AND car_id = $car_id AND current = 'DC'\n)/(\n SELECT sum(greatest(charge_energy_added, charge_energy_used))\n FROM data\n WHERE $__timeFilter(end_date) AND car_id = $car_id AND current = 'DC'\n )", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "DC Avg Cost per kWh", + "type": "stat" + }, + { + "datasource": "TeslaMate", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#d8d9da", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 2, + "x": 22, + "y": 1 + }, + "id": 32, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": "TeslaMate", + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "WITH data AS (\n SELECT\n\t\tcp.id,\n cp.cost,\n cp.end_date,\n cp.car_id,\n cp.charge_energy_added,\n cp.charge_energy_used,\n\t\tCASE WHEN NULLIF(mode() within group (order by charger_phases),0) is null THEN 'DC'\n\t\t\t\t ELSE 'AC'\n\t\tEND AS current\n\tFROM charging_processes cp\n RIGHT JOIN charges ON cp.id = charges.charging_process_id\n WHERE\n\t cp.car_id = $car_id\n\t AND $__timeFilter(end_date)\n GROUP BY 1\n)\nSELECT (\n SELECT \n sum(cost)\n FROM data\n WHERE $__timeFilter(end_date) AND car_id = $car_id AND current = 'AC'\n)/(\n SELECT sum(greatest(charge_energy_added, charge_energy_used))\n FROM data\n WHERE $__timeFilter(end_date) AND car_id = $car_id AND current = 'AC'\n )", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "AC Avg Cost per kWh", + "type": "stat" + }, { "cards": {}, "color": { @@ -502,6 +718,21 @@ }, "dataFormat": "timeseries", "datasource": "TeslaMate", + "fieldConfig": { + "defaults": { + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "scaleDistribution": { + "type": "linear" + } + } + }, + "overrides": [] + }, "gridPos": { "h": 6, "w": 12, @@ -515,6 +746,52 @@ "legend": { "show": false }, + "options": { + "calculate": true, + "calculation": { + "yBuckets": { + "mode": "size", + "value": "10.00001" + } + }, + "cellGap": 2, + "cellValues": {}, + "color": { + "exponent": 0.5, + "fill": "#b4ff00", + "min": 0, + "mode": "opacity", + "reverse": false, + "scale": "exponential", + "scheme": "Oranges", + "steps": 128 + }, + "exemplars": { + "color": "rgba(255,0,255,0.7)" + }, + "filterValues": { + "le": 1e-9 + }, + "legend": { + "show": false + }, + "rowsFrame": { + "layout": "auto" + }, + "showValue": "never", + "tooltip": { + "mode": "single", + "showColorScale": false, + "yHistogram": false + }, + "yAxis": { + "axisPlacement": "left", + "max": "100", + "reverse": false, + "unit": "short" + } + }, + "pluginVersion": "10.4.0", "reverseYBuckets": false, "targets": [ { @@ -571,6 +848,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -582,6 +862,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -672,8 +953,9 @@ "options": { "legend": { "calcs": [], - "displayMode": "hidden", - "placement": "bottom" + "displayMode": "list", + "placement": "bottom", + "showLegend": false }, "tooltip": { "mode": "multi", @@ -772,7 +1054,6 @@ "y": 10 }, "id": 18, - "links": [], "maxDataPoints": 3, "options": { "displayLabels": ["name"], @@ -780,6 +1061,7 @@ "calcs": [], "displayMode": "table", "placement": "bottom", + "showLegend": true, "values": ["value", "percent"] }, "pieType": "pie", @@ -964,7 +1246,7 @@ "zoom": 15 } }, - "pluginVersion": "10.2.0", + "pluginVersion": "10.4.0", "targets": [ { "datasource": "TeslaMate", @@ -1073,7 +1355,6 @@ "y": 10 }, "id": 20, - "links": [], "maxDataPoints": 3, "options": { "displayLabels": ["name"], @@ -1081,6 +1362,7 @@ "calcs": [], "displayMode": "table", "placement": "bottom", + "showLegend": true, "values": ["value", "percent"] }, "pieType": "pie", @@ -1158,7 +1440,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1194,7 +1477,6 @@ "y": 23 }, "id": 29, - "links": [], "options": { "dims": { "exclude": ["charging_process_id"], @@ -1310,7 +1592,6 @@ } ], "title": "DC Charging Curve", - "transformations": [], "type": "xychart" }, { @@ -1319,7 +1600,9 @@ "defaults": { "custom": { "align": "auto", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "inspect": false }, "mappings": [], @@ -1327,8 +1610,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1349,8 +1631,10 @@ "value": "SOC" }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { "id": "unit", @@ -1369,8 +1653,11 @@ "value": "# of Charges" }, { - "id": "custom.displayMode", - "value": "gradient-gauge" + "id": "custom.cellOptions", + "value": { + "mode": "gradient", + "type": "gauge" + } }, { "id": "max" @@ -1390,7 +1677,6 @@ "y": 39 }, "id": 2, - "links": [], "options": { "footer": { "fields": "", @@ -1436,7 +1722,9 @@ "defaults": { "custom": { "align": "auto", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "inspect": false }, "mappings": [], @@ -1444,8 +1732,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1475,8 +1762,7 @@ "mode": "absolute", "steps": [ { - "color": "red", - "value": null + "color": "red" }, { "color": "#EAB839", @@ -1490,8 +1776,10 @@ } }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { "id": "custom.width", @@ -1510,8 +1798,11 @@ "value": "# of Discharges" }, { - "id": "custom.displayMode", - "value": "gradient-gauge" + "id": "custom.cellOptions", + "value": { + "mode": "gradient", + "type": "gauge" + } }, { "id": "min", @@ -1528,7 +1819,6 @@ "y": 39 }, "id": 13, - "links": [], "options": { "footer": { "fields": "", @@ -1574,7 +1864,9 @@ "defaults": { "custom": { "align": "auto", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "inspect": false }, "mappings": [], @@ -1582,8 +1874,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1678,7 +1969,9 @@ "defaults": { "custom": { "align": "auto", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "inspect": false }, "mappings": [], @@ -1686,8 +1979,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1784,8 +2076,7 @@ } ], "refresh": false, - "schemaVersion": 36, - "style": "dark", + "schemaVersion": 39, "tags": ["tesla"], "templating": { "list": [ @@ -1895,6 +2186,6 @@ "timezone": "", "title": "Charging Stats - LFP", "uid": "UcjFKmUtpt", - "version": 1, + "version": 2, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate/charging-stats.json b/charts/incubator/teslamate/dashboards/teslamate/charging-stats.json index 3b176f386ad..531ddccdc0d 100644 --- a/charts/incubator/teslamate/dashboards/teslamate/charging-stats.json +++ b/charts/incubator/teslamate/dashboards/teslamate/charging-stats.json @@ -22,7 +22,6 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 1, - "iteration": 1658137661652, "links": [ { "icon": "dashboard", @@ -82,7 +81,6 @@ "y": 1 }, "id": 8, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -97,9 +95,11 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "format": "table", @@ -156,7 +156,6 @@ "y": 1 }, "id": 10, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -171,9 +170,11 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "format": "table", @@ -226,12 +227,11 @@ }, "gridPos": { "h": 3, - "w": 4, + "w": 3, "x": 10, "y": 1 }, "id": 14, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -246,9 +246,11 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "datasource": "TeslaMate", @@ -302,12 +304,11 @@ }, "gridPos": { "h": 3, - "w": 4, - "x": 14, + "w": 3, + "x": 13, "y": 1 }, "id": 27, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -322,9 +323,11 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "format": "table", @@ -377,8 +380,8 @@ }, "gridPos": { "h": 3, - "w": 3, - "x": 18, + "w": 2, + "x": 16, "y": 1 }, "id": 26, @@ -392,9 +395,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "format": "table", @@ -449,8 +454,8 @@ }, "gridPos": { "h": 3, - "w": 3, - "x": 21, + "w": 2, + "x": 18, "y": 1 }, "id": 31, @@ -464,9 +469,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.5.6", + "pluginVersion": "10.4.0", "targets": [ { "format": "table", @@ -490,6 +497,176 @@ "title": "Average Cost per kWh", "type": "stat" }, + { + "datasource": "TeslaMate", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#d8d9da", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 2, + "x": 20, + "y": 1 + }, + "id": 32, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": "TeslaMate", + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "WITH data AS (\n SELECT\n\t\tcp.id,\n cp.cost,\n cp.end_date,\n cp.car_id,\n cp.charge_energy_added,\n cp.charge_energy_used,\n\t\tCASE WHEN NULLIF(mode() within group (order by charger_phases),0) is null THEN 'DC'\n\t\t\t\t ELSE 'AC'\n\t\tEND AS current\n\tFROM charging_processes cp\n RIGHT JOIN charges ON cp.id = charges.charging_process_id\n WHERE\n\t cp.car_id = $car_id\n\t AND $__timeFilter(end_date)\n GROUP BY 1\n)\nSELECT (\n SELECT \n sum(cost)\n FROM data\n WHERE $__timeFilter(end_date) AND car_id = $car_id AND current = 'DC'\n)/(\n SELECT sum(greatest(charge_energy_added, charge_energy_used))\n FROM data\n WHERE $__timeFilter(end_date) AND car_id = $car_id AND current = 'DC'\n )", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "DC Avg Cost per kWh", + "type": "stat" + }, + { + "datasource": "TeslaMate", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#d8d9da", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 2, + "x": 22, + "y": 1 + }, + "id": 33, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": "TeslaMate", + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "WITH data AS (\n SELECT\n\t\tcp.id,\n cp.cost,\n cp.end_date,\n cp.car_id,\n cp.charge_energy_added,\n cp.charge_energy_used,\n\t\tCASE WHEN NULLIF(mode() within group (order by charger_phases),0) is null THEN 'DC'\n\t\t\t\t ELSE 'AC'\n\t\tEND AS current\n\tFROM charging_processes cp\n RIGHT JOIN charges ON cp.id = charges.charging_process_id\n WHERE\n\t cp.car_id = $car_id\n\t AND $__timeFilter(end_date)\n GROUP BY 1\n)\nSELECT (\n SELECT \n sum(cost)\n FROM data\n WHERE $__timeFilter(end_date) AND car_id = $car_id AND current = 'AC'\n)/(\n SELECT sum(greatest(charge_energy_added, charge_energy_used))\n FROM data\n WHERE $__timeFilter(end_date) AND car_id = $car_id AND current = 'AC'\n )", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "AC Avg Cost per kWh", + "type": "stat" + }, { "cards": {}, "color": { @@ -502,6 +679,21 @@ }, "dataFormat": "timeseries", "datasource": "TeslaMate", + "fieldConfig": { + "defaults": { + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "scaleDistribution": { + "type": "linear" + } + } + }, + "overrides": [] + }, "gridPos": { "h": 6, "w": 12, @@ -515,6 +707,52 @@ "legend": { "show": false }, + "options": { + "calculate": true, + "calculation": { + "yBuckets": { + "mode": "size", + "value": "10.00001" + } + }, + "cellGap": 2, + "cellValues": {}, + "color": { + "exponent": 0.5, + "fill": "#b4ff00", + "min": 0, + "mode": "opacity", + "reverse": false, + "scale": "exponential", + "scheme": "Oranges", + "steps": 128 + }, + "exemplars": { + "color": "rgba(255,0,255,0.7)" + }, + "filterValues": { + "le": 1e-9 + }, + "legend": { + "show": false + }, + "rowsFrame": { + "layout": "auto" + }, + "showValue": "never", + "tooltip": { + "mode": "single", + "showColorScale": false, + "yHistogram": false + }, + "yAxis": { + "axisPlacement": "left", + "max": "100", + "reverse": false, + "unit": "short" + } + }, + "pluginVersion": "10.4.0", "reverseYBuckets": false, "targets": [ { @@ -571,6 +809,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -582,6 +823,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -672,8 +914,9 @@ "options": { "legend": { "calcs": [], - "displayMode": "hidden", - "placement": "bottom" + "displayMode": "list", + "placement": "bottom", + "showLegend": false }, "tooltip": { "mode": "multi", @@ -772,7 +1015,6 @@ "y": 10 }, "id": 18, - "links": [], "maxDataPoints": 3, "options": { "displayLabels": ["name"], @@ -780,6 +1022,7 @@ "calcs": [], "displayMode": "table", "placement": "bottom", + "showLegend": true, "values": ["value", "percent"] }, "pieType": "pie", @@ -964,7 +1207,7 @@ "zoom": 15 } }, - "pluginVersion": "10.2.0", + "pluginVersion": "10.4.0", "targets": [ { "datasource": "TeslaMate", @@ -1073,7 +1316,6 @@ "y": 10 }, "id": 20, - "links": [], "maxDataPoints": 3, "options": { "displayLabels": ["name"], @@ -1081,6 +1323,7 @@ "calcs": [], "displayMode": "table", "placement": "bottom", + "showLegend": true, "values": ["value", "percent"] }, "pieType": "pie", @@ -1158,7 +1401,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1194,7 +1438,6 @@ "y": 23 }, "id": 29, - "links": [], "options": { "dims": { "exclude": ["charging_process_id"], @@ -1310,7 +1553,6 @@ } ], "title": "DC Charging Curve", - "transformations": [], "type": "xychart" }, { @@ -1319,7 +1561,9 @@ "defaults": { "custom": { "align": "auto", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "inspect": false }, "mappings": [], @@ -1327,8 +1571,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1349,8 +1592,10 @@ "value": "SOC" }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { "id": "thresholds", @@ -1358,8 +1603,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "yellow", @@ -1389,8 +1633,11 @@ "value": "# of Charges" }, { - "id": "custom.displayMode", - "value": "gradient-gauge" + "id": "custom.cellOptions", + "value": { + "mode": "gradient", + "type": "gauge" + } }, { "id": "max" @@ -1410,7 +1657,6 @@ "y": 39 }, "id": 2, - "links": [], "options": { "footer": { "fields": "", @@ -1456,7 +1702,9 @@ "defaults": { "custom": { "align": "auto", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "inspect": false }, "mappings": [], @@ -1464,8 +1712,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1495,8 +1742,7 @@ "mode": "absolute", "steps": [ { - "color": "red", - "value": null + "color": "red" }, { "color": "#EAB839", @@ -1510,8 +1756,10 @@ } }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { "id": "custom.width", @@ -1530,8 +1778,11 @@ "value": "# of Discharges" }, { - "id": "custom.displayMode", - "value": "gradient-gauge" + "id": "custom.cellOptions", + "value": { + "mode": "gradient", + "type": "gauge" + } }, { "id": "min", @@ -1548,7 +1799,6 @@ "y": 39 }, "id": 13, - "links": [], "options": { "footer": { "fields": "", @@ -1594,7 +1844,9 @@ "defaults": { "custom": { "align": "auto", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "inspect": false }, "mappings": [], @@ -1602,8 +1854,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1698,7 +1949,9 @@ "defaults": { "custom": { "align": "auto", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "inspect": false }, "mappings": [], @@ -1706,8 +1959,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1804,8 +2056,7 @@ } ], "refresh": false, - "schemaVersion": 36, - "style": "dark", + "schemaVersion": 39, "tags": ["tesla"], "templating": { "list": [ @@ -1915,6 +2166,6 @@ "timezone": "", "title": "Charging Stats", "uid": "-pkIkhmRz", - "version": 1, + "version": 5, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate/internal/charge-details.json b/charts/incubator/teslamate/dashboards/teslamate/internal/charge-details.json index 8706c5e162b..8bd48a46341 100644 --- a/charts/incubator/teslamate/dashboards/teslamate/internal/charge-details.json +++ b/charts/incubator/teslamate/dashboards/teslamate/internal/charge-details.json @@ -11,11 +11,11 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.1.2" + "version": "10.4.0" }, { "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "name": "PostgreSQL", "version": "1.0.0" }, @@ -45,6 +45,7 @@ "datasource": "-- Grafana --", "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": { @@ -60,7 +61,6 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "iteration": 1656106965302, "links": [ { "icon": "dashboard", @@ -82,7 +82,7 @@ "panels": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -91,6 +91,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -369,12 +370,11 @@ }, "gridPos": { "h": 20, - "w": 17, + "w": 13, "x": 0, "y": 0 }, "id": 2, - "links": [], "options": { "legend": { "calcs": ["min", "max"], @@ -392,7 +392,7 @@ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "time_series", @@ -425,100 +425,15 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { "defaults": { - "decimals": 1, - "displayName": "Added", - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "semi-dark-yellow", - "value": null - } - ] + "color": { + "fixedColor": "green", + "mode": "fixed" }, - "unit": "kwatth" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 4, - "x": 17, - "y": 0 - }, - "id": 8, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "value_and_name" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "select coalesce(cp.charge_energy_added, c.charge_energy_added)\r\nfrom charging_processes cp\r\njoin charges c\r\n\ton cp.id = c.charging_process_id\r\nwhere car_id = $car_id\r\nAND cp.id = $charging_process_id\r\nORDER BY c.date desc\r\nfetch first row only", - "refId": "A", - "select": [ - [ - { - "params": ["latitude"], - "type": "column" - } - ] - ], - "table": "addresses", - "timeColumn": "inserted_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ], - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - } - } - ], - "type": "stat" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { "decimals": 2, "displayName": "Cost", "mappings": [ @@ -546,9 +461,9 @@ "overrides": [] }, "gridPos": { - "h": 3, - "w": 3, - "x": 21, + "h": 4, + "w": 5, + "x": 13, "y": 0 }, "id": 6, @@ -569,11 +484,18 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", "format": "table", "group": [], "hide": false, @@ -589,6 +511,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -598,18 +537,15 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - } + ] } ], + "title": "Cost", "type": "stat" }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -646,13 +582,12 @@ "overrides": [] }, "gridPos": { - "h": 2, - "w": 7, - "x": 17, - "y": 3 + "h": 4, + "w": 6, + "x": 18, + "y": 0 }, "id": 10, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -664,11 +599,17 @@ "fields": "/.*/", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -692,18 +633,196 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - } + ] } ], "type": "stat" }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "super-light-blue", + "mode": "palette-classic" + }, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "semi-dark-yellow", + "value": null + } + ] + }, + "unit": "kwatth" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Efficiency" + }, + "properties": [ + { + "id": "unit", + "value": "%" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 5, + "x": 13, + "y": 4 + }, + "id": 8, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT coalesce(cp_added, c_added) AS \"Added\"\r\nFROM (SELECT cp.charge_energy_added AS cp_added from charging_processes cp where id = $charging_process_id) cp\r\nCROSS JOIN (SELECT max(charge_energy_added) AS c_added FROM charges WHERE charging_process_id=$charging_process_id) c", + "refId": "A", + "select": [ + [ + { + "params": ["latitude"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "addresses", + "timeColumn": "inserted_at", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT charge_energy_used AS \"Used\"\r\nFROM charging_processes where id = $charging_process_id", + "refId": "B", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT CASE WHEN charge_energy_used IS NULL THEN NULL ELSE LEAST(charge_energy_added / NULLIF(charge_energy_used, 0), 1.0) * 100 END AS \"Efficiency\"\r\nFROM charging_processes where id = $charging_process_id", + "refId": "C", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Charge Energy", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -736,13 +855,12 @@ "overrides": [] }, "gridPos": { - "h": 15, - "w": 7, - "x": 17, - "y": 5 + "h": 12, + "w": 6, + "x": 18, + "y": 4 }, "id": 4, - "links": [], "maxDataPoints": 500, "options": { "basemap": { @@ -820,12 +938,12 @@ "zoom": 15 } }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", @@ -874,7 +992,685 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "super-light-blue", + "mode": "palette-classic" + }, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "semi-dark-yellow", + "value": null + } + ] + }, + "unit": "%" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 5, + "x": 13, + "y": 8 + }, + "id": 12, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT start_battery_level AS \"Start\" FROM charging_processes WHERE id=$charging_process_id", + "refId": "Start", + "select": [ + [ + { + "params": ["latitude"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "addresses", + "timeColumn": "inserted_at", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT end_battery_level - start_battery_level AS \"Added\" FROM charging_processes WHERE id=$charging_process_id", + "refId": "Added", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT end_battery_level AS \"End\" FROM charging_processes WHERE id=$charging_process_id\r\n", + "refId": "End", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Battery Level", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "orange", + "mode": "fixed" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "kwatt" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 5, + "x": 13, + "y": 12 + }, + "id": 13, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT $__timeGroupAlias(date,$__interval),\r\navg(\r\n case when charger_phases >= 1 then (\r\n case when charger_phases = 2 then 3 when charger_phases = 1 then 1 else 0 end)\r\n * charger_actual_current * charger_voltage / 1000.0 else charger_power end) as \"Power\" \r\nFROM charges WHERE charging_process_id = $charging_process_id\r\nGROUP BY 1 ORDER BY 1 ", + "refId": "Current", + "select": [ + [ + { + "params": ["value"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Average Power", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "orange", + "mode": "palette-classic-by-name" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_c/" + }, + "properties": [ + { + "id": "unit", + "value": "celsius" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*_f/" + }, + "properties": [ + { + "id": "unit", + "value": "fahrenheit" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 5, + "x": 13, + "y": 16 + }, + "id": 15, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT $__timeGroupAlias(date,$__interval),\r\nconvert_celsius(avg(outside_temp), '$temp_unit') as outside_temp_$temp_unit \r\nFROM charges WHERE charging_process_id = $charging_process_id\r\nGROUP BY 1 ORDER BY 1 ", + "refId": "Current", + "select": [ + [ + { + "params": ["value"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Average Outdoor Temperature", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "blue", + "mode": "palette-classic" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "orange", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_km/" + }, + "properties": [ + { + "id": "unit", + "value": "lengthkm" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*_mi/" + }, + "properties": [ + { + "id": "unit", + "value": "lengthmi" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/start*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Start" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/added*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Added" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/end*/" + }, + "properties": [ + { + "id": "displayName", + "value": "End" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 16 + }, + "id": 14, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "vertical", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "alias": "Real", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [], + "hide": false, + "measurement": "km", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT convert_km(start_[[preferred_range]]_range_km, '$length_unit') AS start_$length_unit FROM charging_processes WHERE id=$charging_process_id ", + "refId": "Initial Range", + "resultFormat": "time_series", + "select": [ + [ + { + "params": ["value"], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "alias": "Real", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [], + "hide": false, + "measurement": "km", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT convert_km(end_[[preferred_range]]_range_km - start_[[preferred_range]]_range_km, '$length_unit') AS added_$length_unit FROM charging_processes WHERE id=$charging_process_id ", + "refId": "Range Added", + "resultFormat": "time_series", + "select": [ + [ + { + "params": ["value"], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "alias": "Estimated", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [], + "hide": false, + "measurement": "km", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT convert_km(end_[[preferred_range]]_range_km, '$length_unit') AS end_$length_unit FROM charging_processes WHERE id=$charging_process_id", + "refId": "End Range", + "resultFormat": "time_series", + "select": [ + [ + { + "params": ["value"], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Ranges ($preferred_range)", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -883,6 +1679,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -947,7 +1744,6 @@ "y": 20 }, "id": 11, - "links": [], "options": { "legend": { "calcs": [], @@ -980,7 +1776,7 @@ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", @@ -1027,7 +1823,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -1061,9 +1857,7 @@ "type": "xychart" } ], - "refresh": false, - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [ @@ -1090,7 +1884,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_temperature from settings limit 1;", @@ -1113,7 +1907,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", @@ -1136,7 +1930,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_length from settings limit 1;", @@ -1158,7 +1952,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select preferred_range from settings limit 1;", @@ -1180,7 +1974,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select base_url from settings limit 1;", @@ -1206,6 +2000,7 @@ "to": "now" }, "timepicker": { + "hidden": true, "refresh_intervals": [ "5s", "10s", @@ -1233,6 +2028,6 @@ "timezone": "", "title": "Charge Details", "uid": "BHhxFeZRz", - "version": 2, + "version": 3, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate/internal/drive-details.json b/charts/incubator/teslamate/dashboards/teslamate/internal/drive-details.json index b0b8f9a01c5..50b4c3e861c 100644 --- a/charts/incubator/teslamate/dashboards/teslamate/internal/drive-details.json +++ b/charts/incubator/teslamate/dashboards/teslamate/internal/drive-details.json @@ -1,10 +1,50 @@ { + "__elements": {}, + "__requires": [ + { + "type": "panel", + "id": "barchart", + "name": "Bar chart", + "version": "" + }, + { + "type": "panel", + "id": "geomap", + "name": "Geomap", + "version": "" + }, + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "10.4.0" + }, + { + "type": "datasource", + "id": "grafana-postgresql-datasource", + "name": "PostgreSQL", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], "annotations": { "list": [ { "$$hashKey": "object:31", "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, "iconColor": "rgba(0, 211, 255, 1)", @@ -22,7 +62,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 1, - "iteration": 1658136653681, + "id": null, "links": [ { "icon": "dashboard", @@ -51,14 +91,31 @@ "liveNow": false, "panels": [ { - "datasource": "TeslaMate", + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 40, + "panels": [], + "title": "Car: $car_id", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { - "axisCenteredZero": false, + "axisBorderShow": false, + "axisCenteredZero": true, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", @@ -125,7 +182,7 @@ { "matcher": { "id": "byRegexp", - "options": ".*_mph$" + "options": ".*_mih$" }, "properties": [ { @@ -194,7 +251,7 @@ }, { "id": "custom.axisPlacement", - "value": "left" + "value": "right" }, { "id": "displayName", @@ -210,7 +267,7 @@ "properties": [ { "id": "displayName", - "value": "Battery heater" + "value": "Battery Heater" }, { "id": "unit", @@ -282,7 +339,7 @@ "properties": [ { "id": "displayName", - "value": "usable SOC" + "value": "Usable SOC" }, { "id": "unit", @@ -309,17 +366,136 @@ "value": "hidden" } ] + }, + { + "matcher": { + "id": "byName", + "options": "Power" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "semi-dark-orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Usable SOC" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "semi-dark-green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "SOC" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Range (est.)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-purple", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Range (ideal)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "semi-dark-purple", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Battery Heater" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Speed" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Range (rated)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "semi-dark-purple", + "mode": "fixed" + } + } + ] } ] }, "gridPos": { - "h": 17, + "h": 12, "w": 12, "x": 0, - "y": 0 + "y": 1 }, - "id": 2, - "links": [], + "id": 39, "options": { "legend": { "calcs": ["mean", "max", "min"], @@ -335,13 +511,17 @@ "targets": [ { "alias": "", - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", "format": "time_series", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n\t$__time(date),\n\tconvert_km(speed::numeric, '$length_unit') AS speed_[[length_unit]]h,\n\tpower,\n\tbattery_heater::integer,\n\tconvert_km([[preferred_range]]_battery_range_km, '$length_unit') AS range_[[preferred_range]]_[[length_unit]],\n\tconvert_km(est_battery_range_km, '$length_unit') AS range_estimated_[[length_unit]],\n\tbattery_level,\n\tusable_battery_level\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND\n $__timeFilter(date)\nORDER BY\n\tdate ASC", + "rawSql": "SELECT\n\t$__time(date),\n\tconvert_km(speed::numeric, '$length_unit') AS speed_[[length_unit]]h,\n\tpower,\n\tconvert_km([[preferred_range]]_battery_range_km, '$length_unit') AS range_[[preferred_range]]_[[length_unit]],\n\tconvert_km(est_battery_range_km, '$length_unit') AS range_estimated_[[length_unit]],\n\tbattery_level,\n\tusable_battery_level,\n\tbattery_heater::integer\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND\n $__timeFilter(date)\nORDER BY\n\tdate ASC", "refId": "A", "select": [ [ @@ -351,180 +531,6 @@ } ] ], - "table": "charging", - "timeColumn": "Datum", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Drive", - "type": "timeseries" - }, - { - "datasource": "TeslaMate", - "description": "", - "fieldConfig": { - "defaults": { - "decimals": 2, - "displayName": "Distance", - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "semi-dark-green", - "value": null - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "km" - }, - "properties": [ - { - "id": "unit", - "value": "lengthkm" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "mi" - }, - "properties": [ - { - "id": "unit", - "value": "lengthmi" - } - ] - } - ] - }, - "gridPos": { - "h": 2, - "w": 6, - "x": 12, - "y": 0 - }, - "id": 10, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "select convert_km(distance::numeric, '$length_unit') as \"$length_unit\" from drives where id = $drive_id;", - "refId": "A", - "select": [ - [ - { - "params": ["latitude"], - "type": "column" - } - ] - ], - "table": "addresses", - "timeColumn": "inserted_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "type": "stat" - }, - { - "datasource": "TeslaMate", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "decimals": 1, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "semi-dark-blue", - "value": null - } - ] - }, - "unit": "dtdurations" - }, - "overrides": [] - }, - "gridPos": { - "h": 2, - "w": 3, - "x": 18, - "y": 0 - }, - "id": 34, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": "TeslaMate", - "editorMode": "code", - "format": "table", - "rawQuery": true, - "rawSql": "SELECT ${__to:date:seconds} - ${__from:date:seconds}", - "refId": "A", "sql": { "columns": [ { @@ -541,83 +547,9 @@ } ], "limit": 50 - } - } - ], - "title": "Selected duration", - "type": "stat" - }, - { - "datasource": "TeslaMate", - "description": "", - "fieldConfig": { - "defaults": { - "decimals": 1, - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "semi-dark-blue", - "value": null - } - ] }, - "unit": "dtdurations" - }, - "overrides": [] - }, - "gridPos": { - "h": 2, - "w": 3, - "x": 21, - "y": 0 - }, - "id": 14, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT ((DATE_PART('day', end_date - start_date) * 24 + \n DATE_PART('hour', end_date - start_date)) * 60 +\n DATE_PART('minute', end_date - start_date)) * 60 +\n DATE_PART('second', end_date - start_date) as sec_diff\nFROM drives\nWHERE drives.id = $drive_id;", - "refId": "A", - "select": [ - [ - { - "params": ["latitude"], - "type": "column" - } - ] - ], - "table": "addresses", - "timeColumn": "inserted_at", + "table": "charging", + "timeColumn": "Datum", "timeColumnType": "timestamp", "where": [ { @@ -628,195 +560,14 @@ ] } ], - "title": "Drive duration", - "type": "stat" + "title": "Drive", + "type": "timeseries" }, { - "datasource": "TeslaMate", - "fieldConfig": { - "defaults": { - "decimals": 2, - "displayName": "Energy used", - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "light-yellow", - "value": null - } - ] - }, - "unit": "kwatth" - }, - "overrides": [] + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "gridPos": { - "h": 2, - "w": 6, - "x": 12, - "y": 2 - }, - "id": 12, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT\n\t(NULLIF(GREATEST(start_[[preferred_range]]_range_km - end_[[preferred_range]]_range_km, 0), 0) * car.efficiency)\nFROM\n\tdrives d\nJOIN cars car ON car.id = car_id\nWHERE\n\td.id = $drive_id;", - "refId": "A", - "select": [ - [ - { - "params": ["latitude"], - "type": "column" - } - ] - ], - "table": "addresses", - "timeColumn": "inserted_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "type": "stat" - }, - { - "datasource": "TeslaMate", - "fieldConfig": { - "defaults": { - "displayName": "Consumption", - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "yellow", - "value": 200 - }, - { - "color": "red", - "value": 250 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byRegexp", - "options": "km" - }, - "properties": [ - { - "id": "unit", - "value": "Wh/km" - } - ] - }, - { - "matcher": { - "id": "byRegexp", - "options": "mi" - }, - "properties": [ - { - "id": "unit", - "value": "Wh/mi" - } - ] - } - ] - }, - "gridPos": { - "h": 2, - "w": 6, - "x": 18, - "y": 2 - }, - "id": 18, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": ["mean"], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "select\n\t(NULLIF(GREATEST(start_[[preferred_range]]_range_km - end_[[preferred_range]]_range_km, 0), 0) * car.efficiency) *1000 /\n\t convert_km(distance::numeric, '$length_unit') as \"$length_unit\"\nfrom drives d\nJOIN cars car ON car.id = car_id\nwhere d.id = $drive_id;", - "refId": "A", - "select": [ - [ - { - "params": ["start_km"], - "type": "column" - } - ] - ], - "table": "drives", - "timeColumn": "start_date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "type": "stat" - }, - { - "datasource": "TeslaMate", "fieldConfig": { "defaults": { "color": { @@ -844,13 +595,12 @@ "overrides": [] }, "gridPos": { - "h": 27, + "h": 12, "w": 12, "x": 12, - "y": 4 + "y": 1 }, "id": 4, - "links": [], "maxDataPoints": 50000, "options": { "basemap": { @@ -925,11 +675,14 @@ "zoom": 15 } }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "", - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "editorMode": "code", "format": "time_series", "group": [ @@ -1001,17 +754,20 @@ ] } ], - "title": "Map", "type": "geomap" }, { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1026,246 +782,6 @@ "viz": false }, "insertNulls": false, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "links": [], - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "short" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "tpms_pressure_front_left_bar" - }, - "properties": [ - { - "id": "unit", - "value": "pressurebar" - }, - { - "id": "displayName", - "value": "front left" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "tpms_pressure_front_right_bar" - }, - "properties": [ - { - "id": "unit", - "value": "pressurebar" - }, - { - "id": "displayName", - "value": "front right" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "tpms_pressure_rear_left_bar" - }, - "properties": [ - { - "id": "unit", - "value": "pressurebar" - }, - { - "id": "displayName", - "value": "rear left" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "tpms_pressure_rear_right_bar" - }, - "properties": [ - { - "id": "unit", - "value": "pressurebar" - }, - { - "id": "displayName", - "value": "rear right" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "tpms_pressure_front_left_psi" - }, - "properties": [ - { - "id": "unit", - "value": "pressurepsi" - }, - { - "id": "displayName", - "value": "front left" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "tpms_pressure_front_right_psi" - }, - "properties": [ - { - "id": "unit", - "value": "pressurepsi" - }, - { - "id": "displayName", - "value": "front right" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "tpms_pressure_rear_left_psi" - }, - "properties": [ - { - "id": "unit", - "value": "pressurepsi" - }, - { - "id": "displayName", - "value": "rear left" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "tpms_pressure_rear_right_psi" - }, - "properties": [ - { - "id": "unit", - "value": "pressurepsi" - }, - { - "id": "displayName", - "value": "rear right" - } - ] - } - ] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 17 - }, - "id": 32, - "links": [], - "options": { - "legend": { - "calcs": ["logmin", "max"], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "alias": "", - "datasource": "TeslaMate", - "format": "time_series", - "group": [], - "hide": false, - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT\r\n $__time(date),\r\n convert_tire_pressure(tpms_pressure_fl,'$pressure_unit') AS tpms_pressure_front_left_$pressure_unit,\r\n convert_tire_pressure(tpms_pressure_fr,'$pressure_unit') AS tpms_pressure_front_right_$pressure_unit,\r\n convert_tire_pressure(tpms_pressure_rl,'$pressure_unit') AS tpms_pressure_rear_left_$pressure_unit,\r\n convert_tire_pressure(tpms_pressure_rr,'$pressure_unit') AS tpms_pressure_rear_right_$pressure_unit\r\nFROM\r\n positions\r\nWHERE\r\n car_id = $car_id AND\r\n $__timeFilter(date) AND\r\n tpms_pressure_fl is not null\r\nORDER BY\r\n date ASC", - "refId": "A", - "select": [ - [ - { - "params": ["id"], - "type": "column" - } - ] - ], - "table": "pos", - "timeColumn": "date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Tire Pressure", - "type": "timeseries" - }, - { - "datasource": "TeslaMate", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 5, - "gradientMode": "opacity", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, "lineInterpolation": "smooth", "lineWidth": 1, "pointSize": 5, @@ -1289,7 +805,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1337,7 +854,7 @@ { "id": "color", "value": { - "fixedColor": "semi-dark-blue", + "fixedColor": "super-light-blue", "mode": "fixed" } } @@ -1346,10 +863,10 @@ ] }, "gridPos": { - "h": 6, + "h": 12, "w": 12, "x": 0, - "y": 25 + "y": 13 }, "id": 8, "options": { @@ -1366,7 +883,10 @@ }, "targets": [ { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -1397,13 +917,19 @@ "type": "timeseries" }, { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1415,6 +941,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "smooth", "lineWidth": 1, "pointSize": 5, @@ -1437,7 +964,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1603,10 +1131,10 @@ ] }, "gridPos": { - "h": 8, + "h": 6, "w": 12, - "x": 0, - "y": 31 + "x": 12, + "y": 13 }, "id": 6, "options": { @@ -1623,7 +1151,10 @@ }, "targets": [ { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -1654,9 +1185,276 @@ "type": "timeseries" }, { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "fieldConfig": { "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 5, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "tpms_pressure_front_left_bar" + }, + "properties": [ + { + "id": "unit", + "value": "pressurebar" + }, + { + "id": "displayName", + "value": "Front Left" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tpms_pressure_front_right_bar" + }, + "properties": [ + { + "id": "unit", + "value": "pressurebar" + }, + { + "id": "displayName", + "value": "Front Right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tpms_pressure_rear_left_bar" + }, + "properties": [ + { + "id": "unit", + "value": "pressurebar" + }, + { + "id": "displayName", + "value": "Rear Left" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tpms_pressure_rear_right_bar" + }, + "properties": [ + { + "id": "unit", + "value": "pressurebar" + }, + { + "id": "displayName", + "value": "Rear Right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tpms_pressure_front_left_psi" + }, + "properties": [ + { + "id": "unit", + "value": "pressurepsi" + }, + { + "id": "displayName", + "value": "Front Left" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tpms_pressure_front_right_psi" + }, + "properties": [ + { + "id": "unit", + "value": "pressurepsi" + }, + { + "id": "displayName", + "value": "Front Right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tpms_pressure_rear_left_psi" + }, + "properties": [ + { + "id": "unit", + "value": "pressurepsi" + }, + { + "id": "displayName", + "value": "Rear Left" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tpms_pressure_rear_right_psi" + }, + "properties": [ + { + "id": "unit", + "value": "pressurepsi" + }, + { + "id": "displayName", + "value": "Rear Right" + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 19 + }, + "id": 32, + "options": { + "legend": { + "calcs": ["logmin", "max"], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\r\n $__time(date),\r\n convert_tire_pressure(tpms_pressure_fl,'$pressure_unit') AS tpms_pressure_front_left_$pressure_unit,\r\n convert_tire_pressure(tpms_pressure_fr,'$pressure_unit') AS tpms_pressure_front_right_$pressure_unit,\r\n convert_tire_pressure(tpms_pressure_rl,'$pressure_unit') AS tpms_pressure_rear_left_$pressure_unit,\r\n convert_tire_pressure(tpms_pressure_rr,'$pressure_unit') AS tpms_pressure_rear_right_$pressure_unit\r\nFROM\r\n positions\r\nWHERE\r\n car_id = $car_id AND\r\n $__timeFilter(date) AND\r\n tpms_pressure_fl is not null\r\nORDER BY\r\n date ASC", + "refId": "A", + "select": [ + [ + { + "params": ["id"], + "type": "column" + } + ] + ], + "table": "pos", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Tire Pressure", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 25 + }, + "id": 36, + "panels": [], + "title": "More Details", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "decimals": 2, "mappings": [ { "options": { @@ -1681,33 +1479,147 @@ "overrides": [] }, "gridPos": { - "h": 2, - "w": 12, - "x": 12, - "y": 31 + "h": 3, + "w": 6, + "x": 0, + "y": 26 }, - "id": 16, - "links": [], + "id": 38, "maxDataPoints": 100, "options": { "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", + "graphMode": "area", + "justifyMode": "center", "orientation": "auto", "reduceOptions": { "calcs": ["lastNotNull"], "fields": "/.*/", "values": false }, - "textMode": "value_and_name" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, + "pluginVersion": "10.4.0", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT CONCAT_WS(' - ', round(convert_km(start_km::numeric, '$length_unit')), round(convert_km(end_km::numeric, '$length_unit'))) ||' $length_unit' as \"Odometer\"\nFROM drives d\nWHERE d.id = $drive_id", + "rawSql": "SELECT CONCAT_WS(' - ', round(convert_km(start_km::numeric, '$length_unit')), round(convert_km(end_km::numeric, '$length_unit'))) ||' $length_unit' as \"Odometer\"\r\nFROM drives d\r\nWHERE d.id = $drive_id", + "refId": "A", + "select": [ + [ + { + "params": ["latitude"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "addresses", + "timeColumn": "inserted_at", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Odometer (From - To)", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "decimals": 1, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "text" + } + ] + }, + "unit": "dtdurations" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 6, + "y": 26 + }, + "id": 14, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT ((DATE_PART('day', end_date - start_date) * 24 + \n DATE_PART('hour', end_date - start_date)) * 60 +\n DATE_PART('minute', end_date - start_date)) * 60 +\n DATE_PART('second', end_date - start_date) as sec_diff\nFROM drives\nWHERE drives.id = $drive_id;", "refId": "A", "select": [ [ @@ -1729,11 +1641,368 @@ ] } ], - "transparent": true, + "title": "Drive Duration", "type": "stat" }, { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 1, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "text" + } + ] + }, + "unit": "dtdurations" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 9, + "y": 26 + }, + "id": 34, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT ${__to:date:seconds} - ${__from:date:seconds}", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Selected Duration", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": false, + "axisLabel": "", + "axisPlacement": "auto", + "axisWidth": -10, + "fillOpacity": 90, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "fieldMinMax": true, + "mappings": [], + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-green" + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Elapsed" + }, + "properties": [ + { + "id": "unit", + "value": "percent" + }, + { + "id": "decimals", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 26 + }, + "id": 35, + "options": { + "barRadius": 0.05, + "barWidth": 0.97, + "colorByField": "Elapsed", + "fullHighlight": false, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "orientation": "auto", + "showValue": "auto", + "stacking": "none", + "text": {}, + "tooltip": { + "mode": "multi", + "sort": "none" + }, + "xField": "Speed", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT \r\n speed_section_$length_unit AS \"Speed\",\r\n SUM(seconds_elapsed) * 100 / MAX(duration) as \"Elapsed\",\r\n TO_CHAR((SUM(seconds_elapsed) || ' second')::interval, 'HH24:MI:SS') AS \"Time\"\r\nFROM (\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 EXTRACT(EPOCH FROM (end_date - start_date)) AS duration\r\n FROM drives d\r\n INNER JOIN positions p ON p.drive_id = d.id\r\n WHERE d.id = $drive_id\r\n) AS drivedata\r\nGROUP BY 1\r\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": ["value"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Speed Histogram ($speed_unit)", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": ["Elapsed", "Time", "Speed", "SpeedUnit"] + } + } + } + ], + "type": "barchart" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "decimals": 2, + "displayName": "Distance", + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "semi-dark-green" + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "km" + }, + "properties": [ + { + "id": "unit", + "value": "lengthkm" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "mi" + }, + "properties": [ + { + "id": "unit", + "value": "lengthmi" + } + ] + } + ] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 0, + "y": 29 + }, + "id": 10, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "select convert_km(distance::numeric, '$length_unit') as \"$length_unit\" from drives where id = $drive_id;", + "refId": "A", + "select": [ + [ + { + "params": ["latitude"], + "type": "column" + } + ] + ], + "table": "addresses", + "timeColumn": "inserted_at", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Distance", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "fieldConfig": { "defaults": { "color": { @@ -1752,10 +2021,10 @@ "overrides": [] }, "gridPos": { - "h": 2, - "w": 12, - "x": 0, - "y": 39 + "h": 3, + "w": 6, + "x": 6, + "y": 29 }, "id": 20, "options": { @@ -1768,17 +2037,24 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "value_and_name" + "textMode": "value_and_name", + "wideLayout": true }, + "pluginVersion": "10.4.0", "targets": [ { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH height as (SELECT\n\televation-LAG(elevation,1) over ( order BY\n\tdate ASC ) as diff\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND\n $__timeFilter(date)\nORDER BY\n\tdate ASC\n\t)\n\t\n\nselect convert_m(sum(diff), '$alternative_length_unit') || ' $alternative_length_unit' as \"UP\" from height where diff > 0", + "rawSql": "WITH height as (SELECT\n\televation-LAG(elevation,1) over ( order BY\n\tdate ASC ) as diff\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND\n $__timeFilter(date)\nORDER BY\n\tdate ASC\n\t)\nSELECT ROUND(convert_m(sum(diff), '$alternative_length_unit')::numeric,0) || ' $alternative_length_unit' as \"UP\" from height where diff > 0", "refId": "A", "select": [ [ @@ -1788,6 +2064,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -1800,13 +2093,17 @@ ] }, { - "datasource": "TeslaMate", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH height as (SELECT\n\televation-LAG(elevation,1) over ( order BY\n\tdate ASC ) as diff\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND\n $__timeFilter(date)\nORDER BY\n\tdate ASC\n\t)\n\t\n\t\nselect convert_m(sum(diff), '$alternative_length_unit') || ' $alternative_length_unit' as \"DOWN\" from height where diff < 0", + "rawSql": "WITH height as (SELECT\n\televation-LAG(elevation,1) over ( order BY\n\tdate ASC ) as diff\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND\n $__timeFilter(date)\nORDER BY\n\tdate ASC\n\t)\nSELECT ROUND(convert_m(sum(diff), '$alternative_length_unit')::numeric,0) || ' $alternative_length_unit' as \"DOWN\" from height where diff < 0", "refId": "B", "select": [ [ @@ -1816,6 +2113,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -1830,40 +2144,379 @@ ], "title": "Elevation Summary", "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "light-yellow" + } + ] + }, + "unit": "kwatth" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 0, + "y": 32 + }, + "id": 12, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n\t(NULLIF(GREATEST(start_[[preferred_range]]_range_km - end_[[preferred_range]]_range_km, 0), 0) * car.efficiency)\nFROM\n\tdrives d\nJOIN cars car ON car.id = car_id\nWHERE\n\td.id = $drive_id;", + "refId": "A", + "select": [ + [ + { + "params": ["latitude"], + "type": "column" + } + ] + ], + "table": "addresses", + "timeColumn": "inserted_at", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Energy Used", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "orange", + "mode": "fixed" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "yellow", + "value": 200 + }, + { + "color": "red", + "value": 250 + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "km" + }, + "properties": [ + { + "id": "unit", + "value": "Wh/km" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "mi" + }, + "properties": [ + { + "id": "unit", + "value": "Wh/mi" + } + ] + } + ] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 6, + "y": 32 + }, + "id": 18, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "select\n\t(NULLIF(GREATEST(start_[[preferred_range]]_range_km - end_[[preferred_range]]_range_km, 0), 0) * car.efficiency) *1000 /\n\t convert_km(distance::numeric, '$length_unit') as \"$length_unit\"\nfrom drives d\nJOIN cars car ON car.id = car_id\nwhere d.id = $drive_id;", + "refId": "A", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Consumption", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "super-light-blue", + "mode": "fixed" + }, + "decimals": 0, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_mih/" + }, + "properties": [ + { + "id": "unit", + "value": "velocitymph" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*_kmh/" + }, + "properties": [ + { + "id": "unit", + "value": "velocitykmh" + } + ] + } + ] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 9, + "y": 32 + }, + "id": 37, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": false + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n\tconvert_km(avg(speed)::numeric, '$length_unit') AS speed_[[length_unit]]h\nFROM positions\nWHERE car_id = $car_id AND $__timeFilter(date)", + "refId": "A", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Avg. Speed", + "type": "stat" } ], - "refresh": false, - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [ { - "current": { - "selected": false, - "text": "NULL", - "value": "NULL" - }, + "current": {}, "hide": 2, "name": "drive_id", "options": [ { - "selected": true, + "selected": false, "text": "NULL", "value": "NULL" } ], - "query": "3217", + "query": "", "skipUrlSync": false, "type": "textbox" }, { - "current": { - "selected": false, - "text": "C", - "value": "C" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select unit_of_temperature from settings limit 1;", "hide": 2, "includeAll": false, @@ -1882,12 +2535,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "km", - "value": "km" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select unit_of_length from settings limit 1;", "hide": 2, "includeAll": false, @@ -1906,12 +2558,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "1", - "value": "1" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", "hide": 0, "includeAll": false, @@ -1930,12 +2581,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "m", - "value": "m" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select case when unit_of_length = 'km' then 'm' when unit_of_length = 'mi' then 'ft' end from settings limit 1;", "hide": 2, "includeAll": false, @@ -1954,12 +2604,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "ideal", - "value": "ideal" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select preferred_range from settings limit 1;", "hide": 2, "includeAll": false, @@ -1977,12 +2626,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "", - "value": "" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select base_url from settings limit 1;", "hide": 2, "includeAll": false, @@ -2001,12 +2649,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "bar", - "value": "bar" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select unit_of_pressure from settings limit 1;", "hide": 2, "includeAll": false, @@ -2019,41 +2666,36 @@ "skipUrlSync": false, "sort": 0, "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "definition": "SELECT CASE WHEN '$length_unit' = 'km' THEN 'km/h' WHEN '$length_unit' = 'mi' THEN 'mph' END", + "hide": 2, + "includeAll": false, + "multi": false, + "name": "speed_unit", + "options": [], + "query": "SELECT CASE WHEN '$length_unit' = 'km' THEN 'km/h' WHEN '$length_unit' = 'mi' THEN 'mph' END", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" } ] }, - "time": { - "from": "now-12h", - "to": "now" - }, "timepicker": { - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] + "hidden": true, + "refresh_intervals": [], + "time_options": [] }, "timezone": "", "title": "Drive Details", "uid": "zm7wN6Zgz", - "version": 2, + "version": 4, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate/reports/dutch-tax.json b/charts/incubator/teslamate/dashboards/teslamate/reports/dutch-tax.json index b242b5da143..b063dc61af6 100644 --- a/charts/incubator/teslamate/dashboards/teslamate/reports/dutch-tax.json +++ b/charts/incubator/teslamate/dashboards/teslamate/reports/dutch-tax.json @@ -129,6 +129,18 @@ } ] }, + { + "matcher": { + "id": "byRegexp", + "options": ".*_mi" + }, + "properties": [ + { + "id": "unit", + "value": "mi" + } + ] + }, { "matcher": { "id": "byName", @@ -157,18 +169,6 @@ } ] }, - { - "matcher": { - "id": "byRegexp", - "options": ".*_mi" - }, - "properties": [ - { - "id": "unit", - "value": "mi" - } - ] - }, { "matcher": { "id": "byRegexp", diff --git a/charts/incubator/teslamate/dashboards/teslamate1/statistics.json b/charts/incubator/teslamate/dashboards/teslamate1/statistics.json index d3dd8f2d54e..eea7329c803 100644 --- a/charts/incubator/teslamate/dashboards/teslamate1/statistics.json +++ b/charts/incubator/teslamate/dashboards/teslamate1/statistics.json @@ -21,7 +21,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "iteration": 1642773094879, + "iteration": 1642773094880, "links": [ { "icon": "dashboard", @@ -158,6 +158,10 @@ } ] } + }, + { + "id": "max", + "value": 1 } ] }, @@ -427,6 +431,32 @@ { "id": "unit", "value": "fahrenheit" + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue", + "value": null + }, + { + "color": "super-light-green", + "value": 50 + }, + { + "color": "super-light-red", + "value": 68 + } + ] + } } ] }, @@ -491,7 +521,7 @@ } ] }, - "pluginVersion": "8.3.4", + "pluginVersion": "10.4.1", "repeatDirection": "h", "targets": [ { @@ -499,7 +529,7 @@ "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 -- with Postgres 12:\n -- date_trunc('$period', start_date::TIMESTAMP WITHOUT TIME ZONE, '$timezone') as local_period,\n date_trunc('$period', (start_date::TIMESTAMP WITHOUT TIME ZONE) AT TIME ZONE '$timezone') as local_period,\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_trunc('$period', local_period))*1000 AS date_from,\n EXTRACT(EPOCH FROM date_trunc('$period', local_period + ('1 ' || '$period')::INTERVAL))*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(local_period, 'YYYY Month')\n WHEN 'year' THEN to_char(local_period, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(local_period, 'WW') || ' starting ' || to_char(local_period, 'YYYY-MM-DD')\n ELSE to_char(local_period, 'YYYY-MM-DD')\n END AS display,\n local_period 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('$__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", "refId": "A", "select": [ [ @@ -525,7 +555,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n charging_processes.*,\n -- with Postgres 12:\n -- date_trunc('$period', start_date::TIMESTAMP WITHOUT TIME ZONE, '$timezone') as local_period\n date_trunc('$period', (start_date::TIMESTAMP WITHOUT TIME ZONE) AT TIME ZONE '$timezone') as local_period\n FROM charging_processes)\nSELECT\n EXTRACT(EPOCH FROM date_trunc('$period', local_period))*1000 AS date_from,\n EXTRACT(EPOCH FROM date_trunc('$period', local_period + ('1 ' || '$period')::INTERVAL))*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(local_period, 'YYYY Month')\n WHEN 'year' THEN to_char(local_period, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(local_period, 'WW') || ' starting ' || to_char(local_period, 'YYYY-MM-DD')\n ELSE to_char(local_period, 'YYYY-MM-DD')\n END AS display,\n local_period 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('$__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", "refId": "B", "select": [ [ @@ -550,7 +580,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n drives.*,\n -- with Postgres 12:\n -- date_trunc('$period', start_date::TIMESTAMP WITHOUT TIME ZONE, '$timezone') as local_period\n date_trunc('$period', (start_date::TIMESTAMP WITHOUT TIME ZONE) AT TIME ZONE '$timezone') as local_period\n FROM drives)\nSELECT\n EXTRACT(EPOCH FROM date_trunc('$period', local_period))*1000 AS date_from,\n EXTRACT(EPOCH FROM date_trunc('$period', local_period + ('1 ' || '$period')::INTERVAL))*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(local_period, 'YYYY Month')\n WHEN 'year' THEN to_char(local_period, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(local_period, 'WW') || ' starting ' || to_char(local_period, 'YYYY-MM-DD')\n ELSE to_char(local_period, 'YYYY-MM-DD')\n END AS display,\n local_period 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('$__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", "refId": "C", "select": [ [ @@ -713,6 +743,7 @@ "avg_cost_mi": 20, "avg_cost_kwh": 11, "avg_outside_temp_c": 5, + "avg_outside_temp_f": 5, "cnt": 6, "cnt_charges": 11, "cost_charges": 10, @@ -756,7 +787,7 @@ } ], "refresh": false, - "schemaVersion": 36, + "schemaVersion": 39, "style": "dark", "tags": ["tesla"], "templating": { @@ -899,30 +930,7 @@ { "current": { "selected": false, - "text": "Europe/Berlin", - "value": "Europe/Berlin" - }, - "datasource": "TeslaMate", - "definition": "select current_setting('TIMEZONE'), name from pg_timezone_names where abbrev ~ '^[a-zA-Z]{3,4}$' and name not like 'posix%' order by 2;", - "hide": 0, - "includeAll": false, - "label": "Time zone", - "multi": false, - "name": "timezone", - "options": [], - "query": "select current_setting('TIMEZONE'), name from pg_timezone_names where abbrev ~ '^[a-zA-Z]{3,4}$' and name not like 'posix%' order by 2;", - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "tagValuesQuery": "", - "tagsQuery": "", - "type": "query", - "useTags": false - }, - { - "current": { - "selected": false, + "text": "http://localhost:4000", "value": "http://localhost:4000" }, @@ -965,7 +973,7 @@ }, "timezone": "browser", "title": "Statistics", - "uid": "1EZnXszMk", - "version": 1, + "uid": "1EZnXszMl", + "version": 2, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate1/visited.json b/charts/incubator/teslamate/dashboards/teslamate1/visited.json index 08ff417b4e1..a093b9df6f7 100644 --- a/charts/incubator/teslamate/dashboards/teslamate1/visited.json +++ b/charts/incubator/teslamate/dashboards/teslamate1/visited.json @@ -11,13 +11,19 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.1.2" + "version": "10.4.0" }, { "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "name": "PostgreSQL", "version": "1.0.0" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" } ], "annotations": { @@ -30,6 +36,7 @@ }, "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", "type": "dashboard" @@ -81,7 +88,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -116,13 +123,14 @@ "y": 1 }, "id": 2, - "links": [], "maxDataPoints": 10000000, "options": { "basemap": { - "config": {}, + "config": { + "server": "streets" + }, "name": "Layer 0", - "type": "osm-standard" + "type": "esri-xyz" }, "controls": { "mouseWheelZoom": true, @@ -181,7 +189,7 @@ } ], "tooltip": { - "mode": "details" + "mode": "none" }, "view": { "allLayers": true, @@ -191,18 +199,18 @@ "zoom": 15 } }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", "format": "table", "hide": false, "rawQuery": true, - "rawSql": "SELECT\n to_timestamp(floor((extract('epoch' FROM date) / 60)) * 60) AT TIME ZONE 'UTC' AS time,\n avg(latitude) as latitude,\n avg(longitude) as longitude\nFROM\n positions\nWHERE\n car_id = $car_id\nAND\n $__timeFilter(date)\nGROUP BY\n 1\nORDER BY\n 1\nASC", + "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)\nGROUP BY 1\nORDER BY 1", "refId": "Positions", "sql": { "columns": [ @@ -222,20 +230,426 @@ } } ], - "title": "MAP", "type": "geomap" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 5, + "x": 0, + "y": 22 + }, + "id": 5, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT ROUND(convert_km((max(end_km) - min(start_km))::numeric, '$length_unit'),0)|| ' $length_unit' as \"Distance Traveled\"\nFROM drives WHERE car_id = $car_id AND $__timeFilter(start_date)", + "refId": "distance traveled", + "select": [ + [ + { + "params": ["efficiency"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "cars", + "timeColumn": "inserted_at", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "light-yellow", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Total energy added" + }, + "properties": [ + { + "id": "unit", + "value": "kwatth" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Total energy used" + }, + "properties": [ + { + "id": "unit", + "value": "kwatth" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Charge Efficiency" + }, + "properties": [ + { + "id": "unit", + "value": "percent" + } + ] + } + ] + }, + "gridPos": { + "h": 2, + "w": 14, + "x": 5, + "y": 22 + }, + "id": 6, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "fieldOptions": { + "calcs": ["mean"] + }, + "graphMode": "none", + "justifyMode": "center", + "orientation": "vertical", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n\tsum(charge_energy_added) as \"Total energy added\"\nFROM\n\tcharging_processes\nWHERE\n\tcar_id = $car_id AND $__timeFilter(start_date) AND charge_energy_added > 0.01", + "refId": "Total energy added", + "select": [ + [ + { + "params": ["efficiency"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "cars", + "timeColumn": "inserted_at", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\r\n\tSUM(charge_energy_used) AS \"Total energy used\"\r\nFROM\r\n\tcharging_processes\r\nWHERE\r\n\tcar_id = $car_id AND $__timeFilter(start_date) AND charge_energy_added > 0.01\r\n", + "refId": "Total energy used", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\r\n\tSUM(charge_energy_added) * 100 / SUM(charge_energy_used) AS \"Charge Efficiency\"\r\nFROM\r\n\tcharging_processes\r\nWHERE\r\n\tcar_id = $car_id AND $__timeFilter(start_date) AND charge_energy_added > 0.01\r\n", + "refId": "Charge Efficiency", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "decimals": 2, + "displayName": "Cost", + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#c7d0d9", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 5, + "x": 19, + "y": 22 + }, + "id": 7, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "fieldOptions": { + "calcs": ["lastNotNull"] + }, + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "select sum(cost) as \"Cost\" from charging_processes where $__timeFilter(start_date) AND car_id = $car_id;", + "refId": "A", + "select": [ + [ + { + "params": ["latitude"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "addresses", + "timeColumn": "inserted_at", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "type": "stat" } ], "refresh": false, - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": ["tesla"], "templating": { "list": [ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", @@ -256,12 +670,11 @@ "useTags": false }, { - "current": { - "selected": false, - "text": "http://localhost:4000", - "value": "http://localhost:4000" + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" }, - "datasource": "TeslaMate", "definition": "select base_url from settings limit 1;", "hide": 2, "includeAll": false, @@ -278,6 +691,21 @@ "tagsQuery": "", "type": "query", "useTags": false + }, + { + "current": {}, + "definition": "SELECT unit_of_length FROM settings LIMIT 1", + "hide": 2, + "includeAll": false, + "multi": false, + "name": "length_unit", + "options": [], + "query": "SELECT unit_of_length FROM settings LIMIT 1", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" } ] }, @@ -313,6 +741,6 @@ "timezone": "", "title": "Visited", "uid": "RG_DxSmgk", - "version": 11, + "version": 12, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/BatteryHealth.json b/charts/incubator/teslamate/dashboards/teslamate2/BatteryHealth.json index 2ad8139b02f..e8cc96413be 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/BatteryHealth.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/BatteryHealth.json @@ -423,7 +423,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT ROUND(convert_km((max(odometer) - min(odometer))::numeric, '$length_unit'),0)|| ' $length_unit' as \"Mileage\"\nfrom positions where car_id = $car_id;", + "rawSql": "SELECT ROUND(convert_km((max(end_km) - min(start_km))::numeric, '$length_unit'),0)|| ' $length_unit' as \"Mileage\"\nFROM drives WHERE car_id = $car_id;", "refId": "Mileage", "select": [ [ @@ -472,7 +472,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT ROUND(convert_km(max(odometer)::numeric, '$length_unit'),0) || ' $length_unit' as \"Odometer\"\nfrom positions where car_id = $car_id;", + "rawSql": "SELECT ROUND(convert_km(max(end_km)::numeric, '$length_unit'),0) || ' $length_unit' as \"Odometer\"\nFROM drives WHERE car_id = $car_id;", "refId": "Odometer", "select": [ [ @@ -1836,6 +1836,6 @@ "timezone": "browser", "title": "Battery Health V2", "uid": "jchmRiqUfXgRx", - "version": 23, + "version": 24, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/BrowseCharges.json b/charts/incubator/teslamate/dashboards/teslamate2/BrowseCharges.json index 673f9f3e164..441aa490681 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/BrowseCharges.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/BrowseCharges.json @@ -1,15 +1,15 @@ { - "__elements": [], + "__elements": {}, "__requires": [ { "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "8.5.15" + "version": "10.4.0" }, { "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "name": "PostgreSQL", "version": "1.0.0" }, @@ -31,9 +31,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": { @@ -50,7 +50,6 @@ "fiscalYearStartMonth": 0, "graphTooltip": 0, "id": null, - "iteration": 1686816148286, "links": [ { "icon": "dashboard", @@ -84,7 +83,7 @@ "panels": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "Browse your charges by Geofence, Location, Type, Cost and Duration in order to have an accurate Total of kWh added and their respective costs", @@ -95,7 +94,9 @@ }, "custom": { "align": "center", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "filterable": false, "inspect": false, "minWidth": 150 @@ -276,8 +277,10 @@ "value": 1 }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { "id": "custom.align" @@ -478,8 +481,10 @@ "value": 1 }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { "id": "custom.align" @@ -518,11 +523,11 @@ "properties": [ { "id": "displayName", - "value": "km / h" + "value": "Range added" }, { "id": "unit", - "value": "lengthkm" + "value": "velocitykmh" }, { "id": "custom.align" @@ -533,7 +538,7 @@ }, { "id": "custom.minWidth", - "value": 70 + "value": 120 } ] }, @@ -561,6 +566,32 @@ { "id": "custom.minWidth", "value": 70 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue", + "value": null + }, + { + "color": "super-light-green", + "value": 50 + }, + { + "color": "super-light-red", + "value": 68 + } + ] + } } ] }, @@ -599,18 +630,22 @@ "properties": [ { "id": "displayName", - "value": "mi / h" + "value": "Range added" }, { "id": "unit", - "value": "none" + "value": "velocitymph" }, { "id": "custom.align" }, + { + "id": "decimals", + "value": 0 + }, { "id": "custom.minWidth", - "value": 70 + "value": 120 } ] }, @@ -687,8 +722,11 @@ "value": 0 }, { - "id": "custom.displayMode", - "value": "basic" + "id": "custom.cellOptions", + "value": { + "mode": "basic", + "type": "gauge" + } }, { "id": "color", @@ -795,12 +833,16 @@ "value": "Type" }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { - "id": "custom.displayMode", - "value": "color-text" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } }, { "id": "color", @@ -824,9 +866,10 @@ "y": 0 }, "id": 6, - "links": [], "options": { + "cellHeight": "sm", "footer": { + "countRows": false, "fields": "", "reducer": ["sum"], "show": false @@ -834,11 +877,11 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "8.5.15", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -866,7 +909,6 @@ } ], "title": "Charges: $charge_type", - "transformations": [], "type": "table" }, { @@ -914,7 +956,6 @@ "y": 21 }, "id": 10, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -926,9 +967,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.5.15", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { @@ -998,7 +1041,6 @@ "y": 21 }, "id": 12, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -1010,9 +1052,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.5.15", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { @@ -1083,7 +1127,6 @@ "y": 21 }, "id": 14, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -1095,9 +1138,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.5.15", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { @@ -1169,7 +1214,6 @@ "y": 21 }, "id": 15, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -1181,9 +1225,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.5.15", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { @@ -1210,15 +1256,14 @@ } ], "refresh": "", - "schemaVersion": 36, - "style": "dark", + "schemaVersion": 39, "tags": ["TeslamateCustomDashboards"], "templating": { "list": [ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", @@ -1241,7 +1286,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_length from settings limit 1;", @@ -1264,7 +1309,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_temperature from settings limit 1;", @@ -1287,7 +1332,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select preferred_range from settings limit 1;", @@ -1309,7 +1354,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select base_url from settings limit 1;", @@ -1332,7 +1377,7 @@ "allValue": "-1", "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM geofences ORDER BY name COLLATE \"C\" ASC;", @@ -1376,7 +1421,7 @@ { "allValue": "", "current": { - "selected": true, + "selected": false, "text": ["All"], "value": ["$__all"] }, @@ -1481,6 +1526,6 @@ "timezone": "", "title": "Browse Charges", "uid": "jchmTSmNYvRRk", - "version": 4, + "version": 5, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/ChargingCostsStats.json b/charts/incubator/teslamate/dashboards/teslamate2/ChargingCostsStats.json index 459607f6d62..114a4506ccc 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/ChargingCostsStats.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/ChargingCostsStats.json @@ -44,9 +44,9 @@ "$$hashKey": "object:75", "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": { @@ -2543,7 +2543,7 @@ }, { "id": "custom.align", - "value": "right" + "value": "center" } ] }, @@ -2565,7 +2565,7 @@ }, { "id": "custom.align", - "value": "auto" + "value": "center" } ] }, @@ -2603,7 +2603,7 @@ }, { "id": "custom.align", - "value": "auto" + "value": "center" }, { "id": "custom.cellOptions", @@ -2669,7 +2669,7 @@ }, { "id": "custom.align", - "value": "auto" + "value": "center" } ] }, @@ -2689,7 +2689,7 @@ }, { "id": "custom.align", - "value": "auto" + "value": "center" }, { "id": "custom.cellOptions", @@ -2733,7 +2733,7 @@ }, { "id": "custom.align", - "value": "auto" + "value": "center" } ] }, @@ -2753,11 +2753,11 @@ }, { "id": "custom.width", - "value": 200 + "value": 203 }, { "id": "custom.align", - "value": "auto" + "value": "center" } ] }, @@ -2796,7 +2796,7 @@ }, { "id": "custom.align", - "value": "auto" + "value": "center" } ] }, @@ -2816,7 +2816,7 @@ }, { "id": "custom.width", - "value": 200 + "value": 203 }, { "id": "noValue", @@ -2838,7 +2838,7 @@ }, { "id": "custom.align", - "value": "auto" + "value": "center" } ] }, @@ -2848,13 +2848,39 @@ "options": "/avg_outside_temp_f/" }, "properties": [ + { + "id": "unit", + "value": "fahrenheit" + }, { "id": "displayName", "value": "Temperature" }, { - "id": "unit", - "value": "fahrenheit" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue", + "value": null + }, + { + "color": "super-light-green", + "value": 50 + }, + { + "color": "super-light-red", + "value": 68 + } + ] + } }, { "id": "custom.align", @@ -3094,6 +3120,7 @@ "indexByName": { "avg_consumption_kwh": 8, "avg_outside_temp_c": 3, + "avg_outside_temp_f": 3, "cnt_charges": 7, "cost_charges": 5, "date": 1, @@ -3105,7 +3132,8 @@ "efficiency_charged_net_km_temp": 13, "efficiency_net_km": 9, "sum_consumption_kwh": 6, - "sum_distance_km": 2 + "sum_distance_km": 2, + "sum_distance_mi": 2 }, "renameByName": { "avg_consumption_kwh": "Avg charged", @@ -3265,13 +3293,13 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "WITH data AS (\n\tSELECT c.charging_process_id \n\tFROM charges c\n\tLEFT JOIN charging_processes cp ON cp.id = c.charging_process_id\n\tWHERE \n\t\tcp.car_id = $car_id AND NOT c.fast_charger_present\n GROUP BY 1\n)\nSELECT\n coalesce(sum(cp.cost) , 0)\nFROM\n\tcharging_processes cp, data\nWHERE\n $__timeFilter(end_date)\n AND cp.cost IS NOT NULL\n AND cp.id IN (data.charging_process_id);", + "definition": "WITH data AS (\n\tSELECT c.charging_process_id \n\tFROM charges c\n\tLEFT JOIN charging_processes cp ON cp.id = c.charging_process_id\n\tWHERE \n\t\tcp.car_id = $car_id AND c.charger_voltage != 2\n AND c.fast_charger_present IS NOT true\n GROUP BY 1\n)\nSELECT\n coalesce(sum(cp.cost) , 0)\nFROM\n\tcharging_processes cp, data\nWHERE\n $__timeFilter(end_date)\n AND cp.cost IS NOT NULL\n AND cp.id IN (data.charging_process_id);", "hide": 2, "includeAll": false, "multi": false, "name": "ACCost", "options": [], - "query": "WITH data AS (\n\tSELECT c.charging_process_id \n\tFROM charges c\n\tLEFT JOIN charging_processes cp ON cp.id = c.charging_process_id\n\tWHERE \n\t\tcp.car_id = $car_id AND NOT c.fast_charger_present\n GROUP BY 1\n)\nSELECT\n coalesce(sum(cp.cost) , 0)\nFROM\n\tcharging_processes cp, data\nWHERE\n $__timeFilter(end_date)\n AND cp.cost IS NOT NULL\n AND cp.id IN (data.charging_process_id);", + "query": "WITH data AS (\n\tSELECT c.charging_process_id \n\tFROM charges c\n\tLEFT JOIN charging_processes cp ON cp.id = c.charging_process_id\n\tWHERE \n\t\tcp.car_id = $car_id AND c.charger_voltage != 2\n AND c.fast_charger_present IS NOT true\n GROUP BY 1\n)\nSELECT\n coalesce(sum(cp.cost) , 0)\nFROM\n\tcharging_processes cp, data\nWHERE\n $__timeFilter(end_date)\n AND cp.cost IS NOT NULL\n AND cp.id IN (data.charging_process_id);", "refresh": 2, "regex": "", "skipUrlSync": false, @@ -3303,13 +3331,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT convert_km((max(odometer) - min(odometer))::numeric, '$length_unit')\nfrom positions where car_id = $car_id AND $__timeFilter(date)", + "definition": "SELECT ROUND(convert_km((max(end_km) - min(start_km))::numeric, '$length_unit'),0) as \"Mileage\"\nFROM drives WHERE car_id = $car_id AND $__timeFilter(end_date)", + "error": {}, "hide": 2, "includeAll": false, "multi": false, "name": "distance_driven", "options": [], - "query": "SELECT convert_km((max(odometer) - min(odometer))::numeric, '$length_unit')\nfrom positions where car_id = $car_id AND $__timeFilter(date)", + "query": "SELECT ROUND(convert_km((max(end_km) - min(start_km))::numeric, '$length_unit'),0) as \"Mileage\"\nFROM drives WHERE car_id = $car_id AND $__timeFilter(end_date)", "refresh": 2, "regex": "", "skipUrlSync": false, @@ -3399,6 +3428,6 @@ "timezone": "", "title": "Charging Costs Stats", "uid": "jchmDdLe5uFVk", - "version": 16, + "version": 18, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/ContinuousTrips.json b/charts/incubator/teslamate/dashboards/teslamate2/ContinuousTrips.json index 93d06f58ebe..a080c8f8ae0 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/ContinuousTrips.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/ContinuousTrips.json @@ -5,11 +5,11 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.1.2" + "version": "10.4.0" }, { "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "name": "PostgreSQL", "version": "1.0.0" }, @@ -29,9 +29,9 @@ "type": "datasource", "uid": "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": { @@ -81,7 +81,7 @@ "panels": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "This dashboard has a table with all the trips you've made between charges sessions, so you can browse the longest or shortest mileage you travel.\n\nYou may also take a look to a specific trip from the initial charge session (before the trip) to the end of the of the charge session (after the trip), through the link in the first column that will take you to the Trips dashboard.", @@ -206,6 +206,22 @@ { "id": "custom.minWidth", "value": 200 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "gauge" + } + }, + { + "id": "color", + "value": { + "mode": "continuous-BlPu" + } + }, + { + "id": "max", + "value": 400 } ] }, @@ -416,7 +432,7 @@ { "matcher": { "id": "byName", - "options": "outside_temp_f" + "options": "avg_temp_f" }, "properties": [ { @@ -556,7 +572,6 @@ "y": 0 }, "id": 2, - "links": [], "options": { "cellHeight": "sm", "footer": { @@ -568,12 +583,12 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", @@ -620,20 +635,18 @@ } ], "title": "Long Trips", - "transformations": [], "type": "table" } ], "refresh": "", - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": ["TeslamateCustomDashboards"], "templating": { "list": [ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC", @@ -653,7 +666,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT unit_of_length FROM settings limit 1", @@ -676,7 +689,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT base_url FROM settings LIMIT 1", @@ -698,6 +711,10 @@ }, { "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "definition": "SELECT preferred_range FROM settings LIMIT 1", "hide": 2, "includeAll": false, @@ -714,7 +731,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT unit_of_temperature FROM settings LIMIT 1", @@ -805,6 +822,6 @@ "timezone": "", "title": "Continuous Trips", "uid": "jchmY8upc6ZRk", - "version": 5, + "version": 7, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/CurrentChargeView.json b/charts/incubator/teslamate/dashboards/teslamate2/CurrentChargeView.json index 5e30f174b5f..51b190ebeec 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/CurrentChargeView.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/CurrentChargeView.json @@ -23,11 +23,11 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.1.2" + "version": "10.4.0" }, { "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "name": "PostgreSQL", "version": "1.0.0" }, @@ -58,9 +58,9 @@ "type": "datasource", "uid": "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": { @@ -76,7 +76,6 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": null, "links": [ { "asDropdown": true, @@ -112,14 +111,14 @@ "title": "Current Charge", "tooltip": "Show Current Charge Data", "type": "link", - "url": "d/jchm9RxutVS7a/current-charge-view?kiosk&var-car_id=${car_id}&from=${current_charge_time}&to=${current_end_time}&var-BatteryCapacity=${BatteryCapacity}&var-charging_processes=${charging_processes}" + "url": "d/jchm9RxutVS7a/current-charge-view?kiosk&var-car_id=${car_id}&from=${current_charge_time}&to=${current_end_time}&var-BatteryCapacity=${BatteryCapacity}&var-charging_processes=${charging_processes}&var-temp_unit=${temp_unit}&var-length_unit=${length_unit}&var-preferred_range=${preferred_range}" } ], "liveNow": false, "panels": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -135,8 +134,7 @@ "mode": "absolute", "steps": [ { - "color": "dark-red", - "value": null + "color": "dark-red" }, { "color": "semi-dark-green", @@ -157,16 +155,18 @@ "overrides": [] }, "gridPos": { - "h": 2, - "w": 6, + "h": 3, + "w": 5, "x": 0, "y": 0 }, "id": 8, "options": { "displayMode": "lcd", + "maxVizHeight": 300, "minVizHeight": 10, "minVizWidth": 0, + "namePlacement": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": ["lastNotNull"], @@ -174,16 +174,17 @@ "values": false }, "showUnfilled": true, + "sizing": "auto", "text": { "valueSize": 40 }, "valueMode": "color" }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -230,7 +231,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", @@ -246,8 +247,7 @@ "mode": "absolute", "steps": [ { - "color": "dark-red", - "value": null + "color": "dark-red" }, { "color": "dark-green", @@ -268,16 +268,18 @@ "overrides": [] }, "gridPos": { - "h": 2, - "w": 6, - "x": 6, + "h": 3, + "w": 5, + "x": 5, "y": 0 }, "id": 33, "options": { "displayMode": "gradient", + "maxVizHeight": 300, "minVizHeight": 10, "minVizWidth": 0, + "namePlacement": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": ["lastNotNull"], @@ -285,16 +287,17 @@ "values": false }, "showUnfilled": true, + "sizing": "auto", "text": { "valueSize": 40 }, "valueMode": "color" }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -341,7 +344,111 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "decimals": 0, + "mappings": [], + "max": 49, + "min": 0, + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "light-orange" + } + ] + }, + "unit": "kwatth" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 2, + "x": 10, + "y": 0 + }, + "id": 53, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "alias": "kWh Added", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT $BatteryCapacity AS \"Battery Capacity\"", + "refId": "B", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "Load this dashboard to while you are in a charging session. When you open this dashboard it will show the last 15 minutes, but you should click the \"Current Charge\" button at the top right corner, to enter in Kiosk mode:\n\n- If you are charging, you will see the information from the start time of the current charge session until now and it will refesh automatically every 30 seconds.\n\n- If you are just browsing (not charging) you will see the information of the last charge session.", @@ -361,11 +468,11 @@ "content": "
\n\n
", "mode": "html" }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "time_series", @@ -398,7 +505,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", @@ -416,8 +523,7 @@ "mode": "absolute", "steps": [ { - "color": "light-orange", - "value": null + "color": "light-orange" } ] }, @@ -433,6 +539,8 @@ }, "id": 36, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": ["lastNotNull"], @@ -440,14 +548,15 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": true + "showThresholdMarkers": true, + "sizing": "auto" }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "kWh Added", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "time_series", @@ -482,7 +591,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -496,8 +605,7 @@ "mode": "absolute", "steps": [ { - "color": "super-light-blue", - "value": null + "color": "super-light-blue" } ] } @@ -521,14 +629,16 @@ "fields": "/^coalesce$/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "value" + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -559,7 +669,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -568,6 +678,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -603,8 +714,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -666,10 +776,10 @@ ] }, "gridPos": { - "h": 20, + "h": 19, "w": 12, "x": 0, - "y": 2 + "y": 3 }, "id": 28, "options": { @@ -689,7 +799,7 @@ { "alias": "Power [kW]", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "time_series", @@ -736,7 +846,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -751,8 +861,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] }, @@ -777,15 +886,17 @@ "fields": "", "values": true }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "Real", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -821,7 +932,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -855,7 +966,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -866,8 +977,7 @@ "mode": "absolute", "steps": [ { - "color": "super-light-blue", - "value": null + "color": "super-light-blue" } ] }, @@ -892,17 +1002,20 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "Elapsed Time", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "groupBy": [ @@ -919,7 +1032,7 @@ "orderByTime": "ASC", "policy": "default", "rawQuery": true, - "rawSql": "WITH start_process AS ( SELECT date FROM charges \twhere charging_process_id=$charging_processes \tORDER BY DATE ASC \tLIMIT 1 ) SELECT EXTRACT(EPOCH FROM (charges.date - start_process.date)) AS \"Elapsed\" FROM charges, start_process WHERE charging_process_id = $charging_processes AND $__timeFilter(charges.date) order by charges.date desc LIMIT 1", + "rawSql": "SELECT EXTRACT(EPOCH FROM (end_date - start_date)) AS \"Elapsed\" FROM \r\n (SELECT min(date) as start_date FROM charges where charging_process_id=$charging_processes) s\r\n CROSS JOIN \r\n (SELECT max(date) as end_date FROM charges where charging_process_id=$charging_processes) e", "refId": "A", "resultFormat": "time_series", "select": [ @@ -934,6 +1047,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "tags": [], "timeColumn": "time", "where": [ @@ -949,7 +1079,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -970,8 +1100,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -985,7 +1114,6 @@ "y": 4 }, "id": 50, - "links": [], "maxDataPoints": 50000, "options": { "basemap": { @@ -1060,12 +1188,12 @@ "zoom": 15 } }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", @@ -1143,7 +1271,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1152,14 +1280,12 @@ "fixedColor": "super-light-yellow", "mode": "fixed" }, - "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] }, @@ -1181,21 +1307,24 @@ "orientation": "auto", "reduceOptions": { "calcs": ["first"], - "fields": "", + "fields": "/^odometer$/", "values": true }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "Real", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "format": "time_series", + "editorMode": "code", + "format": "table", "group": [], "groupBy": [], "hide": false, @@ -1204,7 +1333,7 @@ "orderByTime": "ASC", "policy": "default", "rawQuery": true, - "rawSql": "select $__time(date), convert_km(odometer::numeric, '$length_unit') as \"Odometer\" from positions where car_id = $car_id order by date desc limit 1;", + "rawSql": "SELECT ROUND(convert_km(max(end_km)::numeric, '$length_unit'),0) || ' $length_unit' as odometer\r\nFROM drives WHERE car_id = $car_id;", "refId": "odometer", "resultFormat": "time_series", "select": [ @@ -1215,6 +1344,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -1227,179 +1373,12 @@ ] } ], + "title": "Odometer", "type": "stat" }, { "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "blue", - "mode": "palette-classic" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "orange", - "value": null - } - ] - }, - "unit": "lengthkm" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 12, - "y": 10 - }, - "id": 5, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "text": {}, - "textMode": "auto" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "alias": "Real", - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "time_series", - "group": [], - "groupBy": [], - "hide": false, - "measurement": "km", - "metricColumn": "none", - "orderByTime": "ASC", - "policy": "default", - "rawQuery": true, - "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_km(rated_battery_range_km, '$length_unit')) as \"Initial Range\" FROM charges WHERE charging_process_id = $charging_processes AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 asc limit 1", - "refId": "Initial Range", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "last" - } - ] - ], - "timeColumn": "time", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - }, - { - "alias": "Real", - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "time_series", - "group": [], - "groupBy": [], - "hide": false, - "measurement": "km", - "metricColumn": "none", - "orderByTime": "ASC", - "policy": "default", - "rawQuery": true, - "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_km(rated_battery_range_km, '$length_unit')) as \"Rated Range\" FROM charges WHERE charging_process_id = $charging_processes AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 desc limit 1", - "refId": "Rated", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "last" - } - ] - ], - "timeColumn": "time", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - }, - { - "alias": "Estimated", - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "time_series", - "group": [], - "groupBy": [], - "hide": false, - "measurement": "km", - "metricColumn": "none", - "orderByTime": "ASC", - "policy": "default", - "rawQuery": true, - "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_km(est_battery_range_km, '$length_unit')) as \"Estimated Range\" FROM positions WHERE $__timeFilter(date) GROUP BY 1 ORDER BY 1 desc limit 1", - "refId": "Estimated", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "last" - } - ] - ], - "timeColumn": "time", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "type": "stat" - }, - { - "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1413,8 +1392,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1438,7 +1416,7 @@ "h": 4, "w": 3, "x": 12, - "y": 14 + "y": 10 }, "id": 49, "options": { @@ -1451,14 +1429,16 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "time_series", @@ -1490,7 +1470,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1503,8 +1483,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] }, @@ -1516,7 +1495,7 @@ "h": 4, "w": 3, "x": 15, - "y": 14 + "y": 10 }, "id": 47, "options": { @@ -1529,14 +1508,16 @@ "fields": "/^Volt$/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "time_series", @@ -1567,7 +1548,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1581,8 +1562,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] }, @@ -1594,7 +1574,7 @@ "h": 4, "w": 6, "x": 12, - "y": 18 + "y": 14 }, "id": 34, "options": { @@ -1607,14 +1587,16 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "time_series", @@ -1646,7 +1628,291 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "blue", + "mode": "palette-classic" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "orange" + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_km/" + }, + "properties": [ + { + "id": "unit", + "value": "lengthkm" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*_mi/" + }, + "properties": [ + { + "id": "unit", + "value": "lengthmi" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/start*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Start" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/added*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Added" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/current*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Current" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 18 + }, + "id": 52, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "vertical", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "alias": "Real", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [], + "hide": false, + "measurement": "km", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT MIN(convert_km([[preferred_range]]_battery_range_km, '$length_unit')) as start_$length_unit\r\nFROM charges WHERE charging_process_id = $charging_processes", + "refId": "Initial Range", + "resultFormat": "time_series", + "select": [ + [ + { + "params": ["value"], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "alias": "Real", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [], + "hide": false, + "measurement": "km", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT ROUND(convert_km(end_range - start_range, '$length_unit'),0) as added_$length_unit \r\nFROM\r\n(SELECT MIN([[preferred_range]]_battery_range_km) as start_range\r\nFROM charges WHERE charging_process_id = $charging_processes) s\r\nCROSS JOIN (\r\nSELECT MAX([[preferred_range]]_battery_range_km) as end_range \r\nFROM charges WHERE charging_process_id = $charging_processes) e", + "refId": "Range Added", + "resultFormat": "time_series", + "select": [ + [ + { + "params": ["value"], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "alias": "Estimated", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [], + "hide": false, + "measurement": "km", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT MAX(convert_km([[preferred_range]]_battery_range_km, '$length_unit')) as current_$length_unit \r\nFROM charges WHERE charging_process_id = $charging_processes", + "refId": "Current Range", + "resultFormat": "time_series", + "select": [ + [ + { + "params": ["value"], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Ranges ($preferred_range)", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1667,10 +1933,70 @@ "value": 80 } ] - }, - "unit": "celsius" + } }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_f/" + }, + "properties": [ + { + "id": "unit", + "value": "fahrenheit" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*_c/" + }, + "properties": [ + { + "id": "unit", + "value": "celsius" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/outdoor*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Outdoor" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/inside*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Inside" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/driver*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Driver" + } + ] + } + ] }, "gridPos": { "h": 4, @@ -1689,21 +2015,24 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "time_series", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_celsius(outside_temp, '$temp_unit')) as \"Outdoor\" FROM charges WHERE charging_process_id = $charging_processes AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 ", + "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_celsius(outside_temp, '$temp_unit')) as outdoor_$temp_unit FROM charges WHERE charging_process_id = $charging_processes AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 ", "refId": "Outdoor", "select": [ [ @@ -1713,6 +2042,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -1724,15 +2070,16 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "time_series", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_celsius(inside_temp, '$temp_unit')) AS \"Inside\" FROM positions WHERE car_id = $car_id and inside_temp is not null AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 ", + "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_celsius(inside_temp, '$temp_unit')) AS inside_$temp_unit FROM positions WHERE car_id = $car_id and inside_temp is not null AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 ", "refId": "Inside", "select": [ [ @@ -1742,6 +2089,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -1753,15 +2117,16 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "time_series", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT \t$__timeGroupAlias(date,$__interval), \tavg(convert_celsius(driver_temp_setting, '$temp_unit')) as \"Driver\" FROM positions WHERE driver_temp_setting IS NOT NULL AND car_id = $car_id AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 ", + "rawSql": "SELECT \t$__timeGroupAlias(date,$__interval), \tavg(convert_celsius(driver_temp_setting, '$temp_unit')) as driver_$temp_unit FROM positions WHERE driver_temp_setting IS NOT NULL AND car_id = $car_id AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 ", "refId": "Driver", "select": [ [ @@ -1771,6 +2136,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -1786,16 +2168,14 @@ "type": "stat" } ], - "refresh": false, - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": ["TeslamateCustomDashboards"], "templating": { "list": [ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", @@ -1806,7 +2186,7 @@ "name": "car_id", "options": [], "query": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", - "refresh": 1, + "refresh": 2, "regex": "", "skipUrlSync": false, "sort": 0, @@ -1815,7 +2195,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_length from settings limit 1;", @@ -1834,7 +2214,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_temperature from settings limit 1;", @@ -1853,7 +2233,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "--- Extracted from Battery Health Dashboard", @@ -1862,8 +2242,8 @@ "multi": false, "name": "BatteryCapacity", "options": [], - "query": "SELECT AVG(Capacity) AS CurrentCapacity FROM\n (SELECT (100.0 * cp.charge_energy_added) / (GREATEST(1,MAX(usable_battery_level) - MIN(usable_battery_level))) AS Capacity\t\n FROM charging_processes cp\n\t INNER JOIN charges c ON cp.id = c.charging_process_id\n\t WHERE cp.car_id = $car_id AND \n cp.charge_energy_added >= (SELECT efficiency FROM cars WHERE id = 1) * 100.0\n GROUP BY cp.charge_energy_added, cp.end_date\n ORDER BY cp.end_date DESC \n LIMIT 5) AS lastEstimatedCapacity;", - "refresh": 1, + "query": "WITH Aux AS\n(SELECT car_id,\n\t\tCOALESCE(efficiency, \n\t\t(SELECT efficiency\n\t\t\tFROM cars WHERE id = $car_id) * 100) AS efficiency\n\tFROM (\n\t\tSELECT ROUND((charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric, 3) * 100 as efficiency,\n\t\t\tCOUNT(*) as count, $car_id AS car_id \n\t\tFROM charging_processes\n\t\tWHERE car_id = $car_id\n\t\t\tAND duration_min > 10\n\t\t\tAND end_battery_level <= 95\n\t\t\tAND start_rated_range_km IS NOT NULL\n\t\t\tAND end_rated_range_km IS NOT NULL\n\t\t\tAND charge_energy_added > 0\n\t\tGROUP BY 1\n\t\tORDER BY 2 DESC\n\t\tLIMIT 1\n\t) AS DerivatedEfficiency\n),\nCurrentCapacity\t AS\n(SELECT AVG(Capacity) AS CurrentCapacity \nFROM (\nSELECT \n\tc.[[preferred_range]]_battery_range_km * aux.efficiency / c.usable_battery_level AS Capacity \n\tFROM charging_processes cp\n\t\tINNER JOIN charges c\n\t\tON c.charging_process_id = cp.id \n INNER JOIN aux ON cp.car_id = aux.car_id\n\tWHERE cp.car_id = $car_id\n\t\tAND cp.end_date IS NOT NULL\n\t\tAND cp.charge_energy_added >= aux.efficiency\n\t\tAND c.usable_battery_level > 0\n\t ORDER BY cp.end_date DESC LIMIT 10) AS lastCharges\n)\nSELECT CurrentCapacity FROM CurrentCapacity", + "refresh": 2, "regex": "", "skipUrlSync": false, "sort": 0, @@ -1872,7 +2252,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT (round(extract(epoch FROM start_date) - 10) * 1000) AS start_date_ts FROM charging_processes WHERE id = $charging_processes", @@ -1882,7 +2262,7 @@ "name": "current_charge_time", "options": [], "query": "SELECT (round(extract(epoch FROM start_date) - 10) * 1000) AS start_date_ts FROM charging_processes WHERE id = $charging_processes", - "refresh": 1, + "refresh": 2, "regex": "", "skipUrlSync": false, "sort": 0, @@ -1891,7 +2271,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT id FROM charging_processes WHERE car_id = $car_id ORDER BY start_date DESC LIMIT 1", @@ -1901,7 +2281,7 @@ "name": "charging_processes", "options": [], "query": "SELECT id FROM charging_processes WHERE car_id = $car_id ORDER BY start_date DESC LIMIT 1", - "refresh": 1, + "refresh": 2, "regex": "", "skipUrlSync": false, "sort": 0, @@ -1910,7 +2290,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT CASE WHEN end_date IS NULL THEN 'now&refresh=10s' ELSE CAST(round(extract(epoch FROM end_date) - 10) * 1000 AS VARCHAR(100)) END FROM charging_processes WHERE id = $charging_processes", @@ -1920,6 +2300,26 @@ "name": "current_end_time", "options": [], "query": "SELECT CASE WHEN end_date IS NULL THEN 'now&refresh=10s' ELSE CAST(round(extract(epoch FROM end_date) - 10) * 1000 AS VARCHAR(100)) END FROM charging_processes WHERE id = $charging_processes", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "definition": "select preferred_range from settings limit 1;", + "description": "preferred_range", + "hide": 2, + "includeAll": false, + "multi": false, + "name": "preferred_range", + "options": [], + "query": "select preferred_range from settings limit 1;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1948,6 +2348,6 @@ "timezone": "", "title": "Current Charge View", "uid": "jchm9RxutVS7a", - "version": 7, + "version": 10, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/CurrentDriveView.json b/charts/incubator/teslamate/dashboards/teslamate2/CurrentDriveView.json index 0917402bf8a..ee70e58bb46 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/CurrentDriveView.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/CurrentDriveView.json @@ -7,12 +7,6 @@ "name": "Bar gauge", "version": "" }, - { - "type": "panel", - "id": "gauge", - "name": "Gauge", - "version": "" - }, { "type": "panel", "id": "geomap", @@ -23,11 +17,11 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.1.2" + "version": "10.4.0" }, { "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "name": "PostgreSQL", "version": "1.0.0" }, @@ -50,9 +44,9 @@ "$$hashKey": "object:286", "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": { @@ -69,16 +63,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 1, - "id": null, "links": [ - { - "icon": "dashboard", - "tags": [], - "title": "TeslaMate", - "tooltip": "", - "type": "link", - "url": "[[base_url:raw]]" - }, { "asDropdown": true, "icon": "external link", @@ -108,14 +93,14 @@ "title": "Current Drive", "tooltip": "Adjust to current drive", "type": "link", - "url": "d/jchmkOuP_Fggz/current-drive-view?kiosk&var-car_id=${car_id}&from=${current_drive_start_time}&to=${current_drive_end_time}&var-current_drive=${current_drive}&var-BatteryCapacity=${BatteryCapacity}&var-efficiency=${efficiency}&var-preferred_range=${preferred_range}" + "url": "d/jchmkOuP_Fggz/current-drive-view?kiosk&var-car_id=${car_id}&from=${current_drive_start_time}&to=${current_drive_end_time}&var-current_drive=${current_drive}&var-BatteryCapacity=${BatteryCapacity}&var-efficiency=${efficiency}&var-preferred_range=${preferred_range}&var-length_unit=${length_unit}&var-temp_unit=${temp_unit}&var-alternative_length_unit=${alternative_length_unit}" } ], "liveNow": false, "panels": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "This is a special dashboard to load while driving. When you open this dashboard it will show the last 15 minutes, but you should click the \"Current Drive\" button at the top right corner, to enter in Kiosk mode:\n\n - If you are driving, you will see the information from the start time of the current drive until now and it will refesh automatically every 30 seconds.\n\n - If you are just browsing (not driving) you will see the information of the last drive.", @@ -125,7 +110,8 @@ "mode": "fixed" }, "custom": { - "axisCenteredZero": false, + "axisBorderShow": false, + "axisCenteredZero": true, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", @@ -303,17 +289,32 @@ "value": "hidden" } ] + }, + { + "matcher": { + "id": "byName", + "options": "elevation_ft" + }, + "properties": [ + { + "id": "unit", + "value": "lengthft" + }, + { + "id": "displayName", + "value": "Elevation" + } + ] } ] }, "gridPos": { - "h": 12, - "w": 20, + "h": 11, + "w": 16, "x": 0, "y": 0 }, "id": 26, - "links": [], "options": { "legend": { "calcs": [], @@ -331,9 +332,10 @@ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "time_series", "group": [], "hide": false, @@ -349,6 +351,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charging", "timeColumn": "Datum", "timeColumnType": "timestamp", @@ -362,7 +381,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "time_series", @@ -392,1007 +411,12 @@ ] } ], - "title": "Power", + "title": "Drive", "type": "timeseries" }, { "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byRegexp", - "options": ".*_km" - }, - "properties": [ - { - "id": "unit", - "value": "Wh/km" - } - ] - }, - { - "matcher": { - "id": "byRegexp", - "options": ".*_mi" - }, - "properties": [ - { - "id": "unit", - "value": "Wh/mi" - } - ] - } - ] - }, - "gridPos": { - "h": 3, - "w": 4, - "x": 20, - "y": 0 - }, - "id": 24, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": ["mean"], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "WITH d 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 charging_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 AND\n\t $__timeFilter(start_date)\n\tORDER BY start_date\n),\n\nrange_loss_between_charges AS (\n SELECT sum(range_loss) AS range_loss\n FROM d\n WHERE distance >= 0 AND range_loss >= 0\n GROUP BY car_id\n),\n\ncharge_dates AS (\n\tSELECT\n\t\tmin(start_date) as first_charge,\n\t\tmax(end_date) as last_charge\n\tFROM\n\t\tcharging_processes\n\tWHERE\n\t\tend_date IS NOT NULL\n\t\tAND car_id = $car_id\n\t\tAND $__timeFilter(start_date)\n),\n\nrange_loss_before_first_charge AS (\n\tSELECT\n\t\tmax([[preferred_range]]_battery_range_km) - min([[preferred_range]]_battery_range_km) AS range_loss\n\tFROM positions, charge_dates\n\tWHERE\n\t\tcar_id = $car_id\n\t\tAND $__timeFilter(date)\n\t\tAND ((select first_charge from charge_dates) is null OR date < (select first_charge from charge_dates))\n),\n\nrange_loss_after_last_charge AS (\n\tSELECT\n\t\tmax([[preferred_range]]_battery_range_km) - min([[preferred_range]]_battery_range_km) AS range_loss\n\tFROM positions, charge_dates\n\tWHERE\n\t\tcar_id = $car_id\n\t\tAND $__timeFilter(date)\n\t\tAND date > (select last_charge from charge_dates)\t\n),\n\ntotal_range_loss AS (\n SELECT sum(range_loss) as range_loss\n FROM (\n SELECT range_loss FROM range_loss_between_charges\n UNION ALL\n SELECT range_loss FROM range_loss_before_first_charge\n UNION ALL\n SELECT range_loss FROM range_loss_after_last_charge\n ) r\n),\n\ndistance AS (\n SELECT max(odometer) - min(odometer) as distance\n FROM positions\n WHERE car_id = $car_id AND $__timeFilter(date)\n)\n\nSELECT \n NULLIF(range_loss, 0) * (c.efficiency * 1000) / convert_km(NULLIF(distance::numeric, 0), '$length_unit') as \"consumption_$length_unit\"\nFROM total_range_loss, distance\nLEFT JOIN cars c ON c.id = $car_id", - "refId": "A", - "select": [ - [ - { - "params": ["start_km"], - "type": "column" - } - ] - ], - "table": "drives", - "timeColumn": "start_date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Current Consumption", - "type": "stat" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "efficiency_km" - }, - "properties": [ - { - "id": "unit", - "value": "Wh/km" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "efficiency_mi" - }, - "properties": [ - { - "id": "unit", - "value": "Wh/mi" - } - ] - } - ] - }, - "gridPos": { - "h": 3, - "w": 4, - "x": 20, - "y": 3 - }, - "id": 32, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "table", - "group": [], - "hide": false, - "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 as \"efficiency_$length_unit\"\nFROM settings\nWHERE\tid = $car_id;\n", - "refId": "A", - "select": [ - [ - { - "params": ["start_km"], - "type": "column" - } - ] - ], - "table": "drives", - "timeColumn": "start_date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Current $preferred_range efficiency", - "type": "stat" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "decimals": 1, - "mappings": [], - "max": 100, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-red", - "value": null - }, - { - "color": "semi-dark-green", - "value": 20 - }, - { - "color": "semi-dark-orange", - "value": 80 - }, - { - "color": "light-blue", - "value": 100 - } - ] - }, - "unit": "%" - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 2, - "x": 20, - "y": 6 - }, - "id": 29, - "options": { - "displayMode": "lcd", - "minVizHeight": 10, - "minVizWidth": 0, - "orientation": "vertical", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "showUnfilled": true, - "text": {}, - "valueMode": "color" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "table", - "group": [], - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "measurement": "%", - "metricColumn": "none", - "orderByTime": "ASC", - "policy": "default", - "rawQuery": true, - "rawSql": "(SELECT battery_level, date\nFROM positions\nWHERE car_id = $car_id\nORDER BY date DESC\nLIMIT 1)\nUNION\nSELECT battery_level, date\nFROM charges c\nJOIN charging_processes p ON p.id = c.charging_process_id\nWHERE $__timeFilter(date) AND p.car_id = $car_id\nORDER BY date DESC\nLIMIT 1", - "refId": "SOC", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["start_km"], - "type": "column" - } - ] - ], - "table": "drives", - "timeColumn": "start_date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "type": "bargauge" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "decimals": 1, - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-red", - "value": null - }, - { - "color": "dark-green", - "value": 7.84 - }, - { - "color": "semi-dark-orange", - "value": 31.36 - }, - { - "color": "light-blue", - "value": 35.28 - } - ] - }, - "unit": "kwatth" - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 2, - "x": 22, - "y": 6 - }, - "id": 31, - "options": { - "displayMode": "gradient", - "minVizHeight": 10, - "minVizWidth": 0, - "orientation": "vertical", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "/^kwh$/", - "values": false - }, - "showUnfilled": true, - "text": {}, - "valueMode": "color" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "table", - "group": [], - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "measurement": "%", - "metricColumn": "none", - "policy": "default", - "rawQuery": true, - "rawSql": "(SELECT battery_level * $BatteryCapacity / 100 as kWh, date, $BatteryCapacity as Total\nFROM positions\nWHERE car_id = $car_id\nORDER BY date DESC\nLIMIT 1)\nUNION\nSELECT battery_level * $BatteryCapacity / 100 as kWh, date, $BatteryCapacity as Total\nFROM charges c\nJOIN charging_processes p ON p.id = c.charging_process_id\nWHERE $__timeFilter(date) AND p.car_id = $car_id\nORDER BY date DESC\nLIMIT 1", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["start_km"], - "type": "column" - } - ] - ], - "table": "drives", - "timeColumn": "start_date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "type": "bargauge" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "decimals": 0, - "mappings": [], - "max": 100, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "semi-dark-green", - "value": null - } - ] - }, - "unit": "degree" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 3, - "x": 0, - "y": 12 - }, - "id": 8, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": ["firstNotNull"], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "WITH last_position AS (\n\tSELECT date, convert_celsius(outside_temp, '$temp_unit') AS \"Outside Temperature [°$temp_unit]\"\n\tFROM positions\n\tWHERE car_id = $car_id AND outside_temp IS NOT NULL AND $__timeFilter(date)\n\tORDER BY date DESC\n\tLIMIT 1\n),\nlast_charge AS (\n\tSELECT date, convert_celsius(outside_temp, '$temp_unit') AS \"Outside Temperature [°$temp_unit]\"\n\tFROM charges\n\tJOIN charging_processes ON charges.charging_process_id = charging_processes.id\n\tWHERE car_id = $car_id AND outside_temp IS NOT NULL AND $__timeFilter(date)\n\tORDER BY date DESC\n\tLIMIT 1\n)\nSELECT * FROM last_position\nUNION ALL\nSELECT * FROM last_charge\nORDER BY date DESC\nLIMIT 1;", - "refId": "A", - "select": [ - [ - { - "params": ["outside_temp"], - "type": "column" - } - ] - ], - "table": "positions", - "timeColumn": "date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Outside Temp", - "type": "gauge" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "decimals": 0, - "mappings": [], - "max": 100, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "semi-dark-green", - "value": null - } - ] - }, - "unit": "degree" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 3, - "x": 3, - "y": 12 - }, - "id": 9, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": ["firstNotNull"], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT\n date,\n convert_celsius(inside_temp, '$temp_unit') AS \"Inside Temperature [°$temp_unit]\"\nFROM positions\nWHERE\n car_id = $car_id\n and inside_temp is not null AND $__timeFilter(date)\norder by date desc\nlimit 1 ", - "refId": "A", - "select": [ - [ - { - "params": ["outside_temp"], - "type": "column" - } - ] - ], - "table": "positions", - "timeColumn": "date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Inside Temp", - "type": "gauge" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "decimals": 0, - "mappings": [], - "max": 100, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "semi-dark-green", - "value": null - } - ] - }, - "unit": "degree" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 3, - "x": 6, - "y": 12 - }, - "id": 16, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": ["firstNotNull"], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT\n\t$__time(date),\n\tconvert_celsius(driver_temp_setting, '$temp_unit') as \"Driver Temperature [°$temp_unit]\"\nFROM positions\nWHERE driver_temp_setting IS NOT NULL AND car_id = $car_id AND $__timeFilter(date)\nORDER BY date DESC\nLIMIT 1;", - "refId": "A", - "select": [ - [ - { - "params": ["outside_temp"], - "type": "column" - } - ] - ], - "table": "positions", - "timeColumn": "date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Driver Temp", - "type": "gauge" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { - "decimals": 1, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#c7d0d9", - "value": null - } - ] - }, - "unit": "lengthkm" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "distance_km" - }, - "properties": [ - { - "id": "unit", - "value": "km" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "distance_mi" - }, - "properties": [ - { - "id": "unit", - "value": "mi" - } - ] - } - ] - }, - "gridPos": { - "h": 3, - "w": 3, - "x": 9, - "y": 12 - }, - "id": 27, - "links": [ - { - "targetBlank": true, - "title": "Mileage", - "url": "/d/NjtMTFggz/mileage?" - } - ], - "maxDataPoints": 100, - "options": { - "colorMode": "value", - "fieldOptions": { - "calcs": ["first"] - }, - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "value" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT convert_km((max(odometer) - min(odometer))::numeric, '$length_unit') as \"distance_$length_unit\"\n FROM positions\n WHERE car_id = $car_id AND $__timeFilter(date)", - "refId": "A", - "select": [ - [ - { - "params": ["value"], - "type": "column" - } - ] - ], - "timeColumn": "time", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Distance", - "type": "stat" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { - "decimals": 0, - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#c7d0d9", - "value": null - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "range_km" - }, - "properties": [ - { - "id": "unit", - "value": "lengthkm" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "range_mi" - }, - "properties": [ - { - "id": "unit", - "value": "lengthmi" - } - ] - } - ] - }, - "gridPos": { - "h": 3, - "w": 3, - "x": 12, - "y": 12 - }, - "id": 14, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "value", - "fieldOptions": { - "calcs": ["first"] - }, - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": ["mean"], - "fields": "", - "values": false - }, - "textMode": "value" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "time_series", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT $__time(date), range as \"range_$length_unit\"\nFROM (\n\t(SELECT date, convert_km([[preferred_range]]_battery_range_km, '$length_unit') AS range\n\tFROM positions\n\tWHERE car_id = $car_id AND [[preferred_range]]_battery_range_km IS NOT NULL\n ORDER BY date DESC\n\tLIMIT 1)\n\tUNION ALL\n\t(SELECT date, convert_km([[preferred_range]]_battery_range_km, '$length_unit') AS range\n\tFROM charges c\n\tJOIN charging_processes p ON p.id = c.charging_process_id\n\tWHERE p.car_id = $car_id\n\tORDER BY date DESC\n\tLIMIT 1)\n) AS data\nORDER BY date DESC\nLIMIT 1;", - "refId": "A", - "select": [ - [ - { - "params": ["value"], - "type": "column" - } - ] - ], - "timeColumn": "time", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Range", - "type": "stat" - }, - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "fieldConfig": { - "defaults": { - "decimals": 0, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#c7d0d9", - "value": null - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "odometer_km" - }, - "properties": [ - { - "id": "unit", - "value": "km" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "odometer_mi" - }, - "properties": [ - { - "id": "unit", - "value": "mi" - } - ] - } - ] - }, - "gridPos": { - "h": 3, - "w": 5, - "x": 15, - "y": 12 - }, - "id": 6, - "links": [ - { - "targetBlank": true, - "title": "Mileage", - "url": "/d/NjtMTFggz/mileage?" - } - ], - "maxDataPoints": 100, - "options": { - "colorMode": "value", - "fieldOptions": { - "calcs": ["first"] - }, - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": ["mean"], - "fields": "", - "values": false - }, - "textMode": "value" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "time_series", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "select $__time(date), convert_km(odometer::numeric, '$length_unit') as \"odometer_$length_unit\"\nfrom positions \nwhere car_id = $car_id \norder by date desc \nlimit 1;", - "refId": "A", - "select": [ - [ - { - "params": ["value"], - "type": "column" - } - ] - ], - "timeColumn": "time", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Odometer", - "type": "stat" - }, - { - "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1422,13 +446,12 @@ "overrides": [] }, "gridPos": { - "h": 10, - "w": 24, - "x": 0, - "y": 15 + "h": 21, + "w": 8, + "x": 16, + "y": 0 }, "id": 33, - "links": [], "maxDataPoints": 50000, "options": { "basemap": { @@ -1503,12 +526,12 @@ "zoom": 15 } }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", @@ -1583,18 +606,1337 @@ } ], "type": "geomap" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "efficiency_km" + }, + "properties": [ + { + "id": "unit", + "value": "Wh/km" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "efficiency_mi" + }, + "properties": [ + { + "id": "unit", + "value": "Wh/mi" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 0, + "y": 11 + }, + "id": 32, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n\t(CASE WHEN '$length_unit' = 'km' THEN $efficiency\n\t WHEN '$length_unit' = 'mi' THEN $efficiency * 1.60934\n\tEND) * 10 as \"efficiency_$length_unit\"", + "refId": "A", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Derivated Efficiency", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "yellow", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*_km" + }, + "properties": [ + { + "id": "unit", + "value": "Wh/km" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*_mi" + }, + "properties": [ + { + "id": "unit", + "value": "Wh/mi" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 4, + "y": 11 + }, + "id": 24, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "WITH d 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 charging_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 AND\n\t $__timeFilter(start_date)\n\tORDER BY start_date\n),\n\nrange_loss_between_charges AS (\n SELECT sum(range_loss) AS range_loss\n FROM d\n WHERE distance >= 0 AND range_loss >= 0\n GROUP BY car_id\n),\n\ncharge_dates AS (\n\tSELECT\n\t\tmin(start_date) as first_charge,\n\t\tmax(end_date) as last_charge\n\tFROM\n\t\tcharging_processes\n\tWHERE\n\t\tend_date IS NOT NULL\n\t\tAND car_id = $car_id\n\t\tAND $__timeFilter(start_date)\n),\n\nrange_loss_before_first_charge AS (\n\tSELECT\n\t\tmax([[preferred_range]]_battery_range_km) - min([[preferred_range]]_battery_range_km) AS range_loss\n\tFROM positions, charge_dates\n\tWHERE\n\t\tcar_id = $car_id\n\t\tAND $__timeFilter(date)\n\t\tAND ((select first_charge from charge_dates) is null OR date < (select first_charge from charge_dates))\n),\n\nrange_loss_after_last_charge AS (\n\tSELECT\n\t\tmax([[preferred_range]]_battery_range_km) - min([[preferred_range]]_battery_range_km) AS range_loss\n\tFROM positions, charge_dates\n\tWHERE\n\t\tcar_id = $car_id\n\t\tAND $__timeFilter(date)\n\t\tAND date > (select last_charge from charge_dates)\t\n),\n\ntotal_range_loss AS (\n SELECT sum(range_loss) as range_loss\n FROM (\n SELECT range_loss FROM range_loss_between_charges\n UNION ALL\n SELECT range_loss FROM range_loss_before_first_charge\n UNION ALL\n SELECT range_loss FROM range_loss_after_last_charge\n ) r\n),\n\ndistance AS (\n SELECT max(odometer) - min(odometer) as distance\n FROM positions\n WHERE car_id = $car_id AND $__timeFilter(date)\n)\n\nSELECT \n NULLIF(range_loss, 0) * (c.efficiency * 1000) / convert_km(NULLIF(distance::numeric, 0), '$length_unit') as \"consumption_$length_unit\"\nFROM total_range_loss, distance\nLEFT JOIN cars c ON c.id = $car_id", + "refId": "A", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Current Consumption", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_f/" + }, + "properties": [ + { + "id": "unit", + "value": "fahrenheit" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*_c/" + }, + "properties": [ + { + "id": "unit", + "value": "celsius" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/outdoor*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Outdoor" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/inside*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Inside" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/driver*/" + }, + "properties": [ + { + "id": "displayName", + "value": "Driver" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 8, + "y": 11 + }, + "id": 34, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_celsius(outside_temp, '$temp_unit')) as outdoor_$temp_unit \r\nFROM positions \r\nWHERE car_id = $car_id AND outside_temp IS NOT NULL AND $__timeFilter(date)\r\nGROUP BY date\r\nORDER BY date", + "refId": "Outdoor", + "select": [ + [ + { + "params": ["value"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_celsius(inside_temp, '$temp_unit')) as inside_$temp_unit \r\nFROM positions \r\nWHERE car_id = $car_id AND outside_temp IS NOT NULL AND $__timeFilter(date)\r\nGROUP BY date\r\nORDER BY date", + "refId": "Inside", + "select": [ + [ + { + "params": ["value"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_celsius(driver_temp_setting, '$temp_unit')) as driver_$temp_unit \r\nFROM positions \r\nWHERE car_id = $car_id AND outside_temp IS NOT NULL AND $__timeFilter(date)\r\nGROUP BY date\r\nORDER BY date", + "refId": "Driver", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "decimals": 1, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue", + "value": null + } + ] + }, + "unit": "clocks" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 12, + "y": 11 + }, + "id": 36, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["sum"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "alias": "Elapsed Time", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": ["$__interval"], + "type": "time" + }, + { + "params": ["null"], + "type": "fill" + } + ], + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT ${__to:date:seconds} - ${__from:date:seconds}", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": ["utc"], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Elapsed", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "decimals": 1, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#c7d0d9", + "value": null + } + ] + }, + "unit": "lengthkm" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "distance_km" + }, + "properties": [ + { + "id": "unit", + "value": "km" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "distance_mi" + }, + "properties": [ + { + "id": "unit", + "value": "mi" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 0, + "y": 15 + }, + "id": 27, + "links": [ + { + "targetBlank": true, + "title": "Mileage", + "url": "/d/NjtMTFggz/mileage?" + } + ], + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "fieldOptions": { + "calcs": ["first"] + }, + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT convert_km((max(odometer) - min(odometer))::numeric, '$length_unit') as \"distance_$length_unit\"\n FROM positions\n WHERE $__timeFilter(date) AND drive_id=$current_drive ", + "refId": "A", + "select": [ + [ + { + "params": ["value"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Distance", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "decimals": 0, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#c7d0d9", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "range_km" + }, + "properties": [ + { + "id": "unit", + "value": "lengthkm" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "range_mi" + }, + "properties": [ + { + "id": "unit", + "value": "lengthmi" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 4, + "y": 15 + }, + "id": 14, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "fieldOptions": { + "calcs": ["first"] + }, + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(convert_km([[preferred_range]]_battery_range_km, '$length_unit')) as range_$length_unit \nFROM positions WHERE $__timeFilter(date) AND drive_id=$current_drive GROUP BY 1 ORDER BY 1 desc limit 1", + "refId": "A", + "select": [ + [ + { + "params": ["value"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Current Range ($preferred_range)", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "decimals": 0, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#c7d0d9", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "odometer_km" + }, + "properties": [ + { + "id": "unit", + "value": "km" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "odometer_mi" + }, + "properties": [ + { + "id": "unit", + "value": "mi" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 8, + "y": 15 + }, + "id": 6, + "links": [ + { + "targetBlank": true, + "title": "Mileage", + "url": "/d/NjtMTFggz/mileage?" + } + ], + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "fieldOptions": { + "calcs": ["first"] + }, + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["mean"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "select $__time(date), convert_km(odometer::numeric, '$length_unit') as \"odometer_$length_unit\"\nfrom positions \nwhere drive_id = $current_drive \norder by date desc \nlimit 1;", + "refId": "A", + "select": [ + [ + { + "params": ["value"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Odometer", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "decimals": 0, + "mappings": [], + "max": 49, + "min": 0, + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "light-orange", + "value": null + } + ] + }, + "unit": "kwatth" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 12, + "y": 15 + }, + "id": 35, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "vertical", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "alias": "kWh Added", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT $BatteryCapacity AS \"Battery Capacity\"", + "refId": "B", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Battery Capacity", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 1, + "mappings": [], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-red", + "value": null + }, + { + "color": "semi-dark-green", + "value": 20 + }, + { + "color": "semi-dark-orange", + "value": 80 + }, + { + "color": "light-blue", + "value": 100 + } + ] + }, + "unit": "%" + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 8, + "x": 0, + "y": 19 + }, + "id": 29, + "options": { + "displayMode": "lcd", + "maxVizHeight": 300, + "minVizHeight": 10, + "minVizWidth": 0, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "text": {}, + "valueMode": "color" + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "format": "table", + "group": [], + "groupBy": [ + { + "params": ["$__interval"], + "type": "time" + }, + { + "params": ["null"], + "type": "fill" + } + ], + "measurement": "%", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "(SELECT battery_level, date\nFROM positions\nWHERE car_id = $car_id\nORDER BY date DESC\nLIMIT 1)\nUNION\nSELECT battery_level, date\nFROM charges c\nJOIN charging_processes p ON p.id = c.charging_process_id\nWHERE $__timeFilter(date) AND p.car_id = $car_id\nORDER BY date DESC\nLIMIT 1", + "refId": "SOC", + "resultFormat": "time_series", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "type": "bargauge" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 1, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-red", + "value": null + }, + { + "color": "dark-green", + "value": 7.84 + }, + { + "color": "semi-dark-orange", + "value": 31.36 + }, + { + "color": "light-blue", + "value": 35.28 + } + ] + }, + "unit": "kwatth" + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 8, + "x": 8, + "y": 19 + }, + "id": 31, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 10, + "minVizWidth": 0, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "/^kwh$/", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "text": {}, + "valueMode": "color" + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "format": "table", + "group": [], + "groupBy": [ + { + "params": ["$__interval"], + "type": "time" + }, + { + "params": ["null"], + "type": "fill" + } + ], + "measurement": "%", + "metricColumn": "none", + "policy": "default", + "rawQuery": true, + "rawSql": "(SELECT battery_level * $BatteryCapacity / 100 as kWh, date, $BatteryCapacity as Total\nFROM positions\nWHERE car_id = $car_id\nORDER BY date DESC\nLIMIT 1)\nUNION\nSELECT battery_level * $BatteryCapacity / 100 as kWh, date, $BatteryCapacity as Total\nFROM charges c\nJOIN charging_processes p ON p.id = c.charging_process_id\nWHERE $__timeFilter(date) AND p.car_id = $car_id\nORDER BY date DESC\nLIMIT 1", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "type": "bargauge" } ], - "refresh": "10s", - "schemaVersion": 38, - "style": "dark", + "refresh": "", + "schemaVersion": 39, "tags": ["TeslamateCustomDashboards"], "templating": { "list": [ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", @@ -1617,7 +1959,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_length from settings limit 1;", @@ -1639,7 +1981,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_temperature from settings limit 1;", @@ -1661,7 +2003,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select preferred_range from settings limit 1;", @@ -1684,30 +2026,7 @@ { "current": {}, "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "definition": "select base_url from settings limit 1;", - "hide": 2, - "includeAll": false, - "label": "", - "multi": false, - "name": "base_url", - "options": [], - "query": "select base_url from settings limit 1;", - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "tagValuesQuery": "", - "tagsQuery": "", - "type": "query", - "useTags": false - }, - { - "current": {}, - "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select case when unit_of_length = 'km' then 'm' when unit_of_length = 'mi' then 'ft' end from settings limit 1;", @@ -1726,7 +2045,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT drive_id FROM positions WHERE car_id = $car_id AND drive_id IS NOT NULL ORDER BY date DESC LIMIT 1;", @@ -1745,7 +2064,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT \n (round(extract(epoch FROM start_date) - 10) * 1000) AS start_date_ts\n FROM drives \n WHERE id = $current_drive", @@ -1764,7 +2083,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT \n CASE WHEN end_date IS NULL THEN 'now&refresh=10s' \n ELSE CAST(round(extract(epoch FROM end_date) - 10) * 1000 AS VARCHAR(100)) END\n FROM drives\n WHERE id = $current_drive", @@ -1783,7 +2102,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "--- Extracted from Battery Health Dashboard", @@ -1792,7 +2111,7 @@ "multi": false, "name": "BatteryCapacity", "options": [], - "query": "SELECT AVG(Capacity) AS CurrentCapacity FROM\n (SELECT (100.0 * cp.charge_energy_added) / (GREATEST(1,MAX(usable_battery_level) - MIN(usable_battery_level))) AS Capacity\t\n FROM charging_processes cp\n\t INNER JOIN charges c ON cp.id = c.charging_process_id\n\t WHERE cp.car_id = $car_id AND \n cp.charge_energy_added >= (SELECT efficiency FROM cars WHERE id = 1) * 100.0\n GROUP BY cp.charge_energy_added, cp.end_date\n ORDER BY cp.end_date DESC \n LIMIT 5) AS lastEstimatedCapacity;", + "query": "WITH Aux AS\n(SELECT car_id,\n\t\tCOALESCE(efficiency, \n\t\t(SELECT efficiency\n\t\t\tFROM cars WHERE id = $car_id) * 100) AS efficiency\n\tFROM (\n\t\tSELECT ROUND((charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric, 3) * 100 as efficiency,\n\t\t\tCOUNT(*) as count, $car_id AS car_id \n\t\tFROM charging_processes\n\t\tWHERE car_id = $car_id\n\t\t\tAND duration_min > 10\n\t\t\tAND end_battery_level <= 95\n\t\t\tAND start_rated_range_km IS NOT NULL\n\t\t\tAND end_rated_range_km IS NOT NULL\n\t\t\tAND charge_energy_added > 0\n\t\tGROUP BY 1\n\t\tORDER BY 2 DESC\n\t\tLIMIT 1\n\t) AS DerivatedEfficiency\n),\nCurrentCapacity\t AS\n(SELECT AVG(Capacity) AS CurrentCapacity \nFROM (\nSELECT \n\tc.[[preferred_range]]_battery_range_km * aux.efficiency / c.usable_battery_level AS Capacity \n\tFROM charging_processes cp\n\t\tINNER JOIN charges c\n\t\tON c.charging_process_id = cp.id \n INNER JOIN aux ON cp.car_id = aux.car_id\n\tWHERE cp.car_id = $car_id\n\t\tAND cp.end_date IS NOT NULL\n\t\tAND cp.charge_energy_added >= aux.efficiency\n\t\tAND c.usable_battery_level > 0\n\t ORDER BY cp.end_date DESC LIMIT 10) AS lastCharges\n)\nSELECT CurrentCapacity FROM CurrentCapacity", "refresh": 2, "regex": "", "skipUrlSync": false, @@ -1802,16 +2121,16 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "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;", + "definition": "--- Extracted from Battery Health Dashboard", "hide": 2, "includeAll": false, "multi": false, "name": "efficiency", "options": [], - "query": "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;", + "query": "\t\tSELECT \n\t\tCOALESCE(efficiency, \n\t\t(SELECT efficiency\n\t\t\tFROM cars WHERE id = $car_id) * 100) AS efficiency\n\tFROM (\n\t\tSELECT ROUND((charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric, 3) * 100 as efficiency,\n\t\t\tCOUNT(*) as count, $car_id AS car_id \n\t\tFROM charging_processes\n\t\tWHERE car_id = $car_id\n\t\t\tAND duration_min > 10\n\t\t\tAND end_battery_level <= 95\n\t\t\tAND start_rated_range_km IS NOT NULL\n\t\t\tAND end_rated_range_km IS NOT NULL\n\t\t\tAND charge_energy_added > 0\n\t\tGROUP BY 1\n\t\tORDER BY 2 DESC\n\t\tLIMIT 1\n\t) AS DerivatedEfficiency", "refresh": 2, "regex": "", "skipUrlSync": false, @@ -1853,6 +2172,6 @@ "timezone": "", "title": "Current Drive View", "uid": "jchmkOuP_Fggz", - "version": 8, + "version": 11, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/CurrentState.json b/charts/incubator/teslamate/dashboards/teslamate2/CurrentState.json index 4c487639572..3b43cc4a29c 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/CurrentState.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/CurrentState.json @@ -17,7 +17,13 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.1.2" + "version": "10.4.0" + }, + { + "type": "datasource", + "id": "grafana-postgresql-datasource", + "name": "PostgreSQL", + "version": "1.0.0" }, { "type": "panel", @@ -25,12 +31,6 @@ "name": "Pie chart", "version": "" }, - { - "type": "datasource", - "id": "postgres", - "name": "PostgreSQL", - "version": "1.0.0" - }, { "type": "panel", "id": "stat", @@ -53,9 +53,9 @@ "type": "datasource", "uid": "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": { @@ -105,7 +105,7 @@ "panels": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "Only distinguishes between online, offline and asleep.", @@ -132,7 +132,6 @@ "y": 0 }, "id": 6, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -147,13 +146,15 @@ "fields": "/^state$/", "values": true }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -187,7 +188,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "This dasboard is just to see the current state of the car with the last data recorded by TeslaMate.\n\nAdditionally, you can see the states stats of the selected period.", @@ -215,7 +216,6 @@ "y": 0 }, "id": 2, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -230,13 +230,15 @@ "fields": "/^time$/", "values": true }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -270,7 +272,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", @@ -333,7 +335,6 @@ "y": 0 }, "id": 69, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -348,13 +349,15 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "time_series", @@ -386,7 +389,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", @@ -449,7 +452,6 @@ "y": 0 }, "id": 70, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -464,13 +466,15 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -502,7 +506,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -551,6 +555,8 @@ }, "id": 85, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": ["mean"], @@ -558,13 +564,14 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": true + "showThresholdMarkers": true, + "sizing": "auto" }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -592,7 +599,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", @@ -620,7 +627,6 @@ "y": 0 }, "id": 71, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -635,13 +641,15 @@ "fields": "", "values": true }, - "textMode": "value_and_name" + "showPercentChange": false, + "textMode": "value_and_name", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -675,7 +683,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -711,7 +719,6 @@ "y": 3 }, "id": 86, - "links": [], "maxDataPoints": 50000, "options": { "basemap": { @@ -786,12 +793,12 @@ "zoom": 15 } }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", @@ -869,7 +876,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -902,6 +909,8 @@ }, "id": 59, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": ["firstNotNull"], @@ -909,13 +918,14 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": true + "showThresholdMarkers": true, + "sizing": "auto" }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -949,7 +959,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -982,6 +992,8 @@ }, "id": 63, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": ["firstNotNull"], @@ -989,13 +1001,14 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": true + "showThresholdMarkers": true, + "sizing": "auto" }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -1029,7 +1042,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1062,6 +1075,8 @@ }, "id": 61, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": ["firstNotNull"], @@ -1069,13 +1084,14 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": true + "showThresholdMarkers": true, + "sizing": "auto" }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -1109,7 +1125,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1149,14 +1165,16 @@ "fields": "/^coalesce$/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "value" + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -1188,7 +1206,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1203,56 +1221,103 @@ "viz": false } }, - "mappings": [ - { - "options": { - "0": { - "color": "super-light-blue", - "index": 0, - "text": "online" - }, - "1": { - "color": "purple", - "index": 1, - "text": "driving" - }, - "2": { - "color": "yellow", - "index": 2, - "text": "charging" - }, - "3": { - "color": "super-light-orange", - "index": 3, - "text": "offline" - }, - "4": { - "color": "green", - "index": 4, - "text": "asleep" - }, - "5": { - "color": "super-light-blue", - "index": 5, - "text": "online" - }, - "6": { - "color": "red", - "index": 6, - "text": "updating" - }, - "null": { - "index": 7, - "text": "N/A" - } - }, - "type": "value" - } - ], + "fieldMinMax": false, + "mappings": [], "noValue": "0", "unit": "dtdhms" }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "offline" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "super-light-orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "online" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#6ed0e0", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "driving" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "semi-dark-purple", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "charging" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-yellow", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "updating" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "semi-dark-red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "asleep" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + } + ] }, "gridPos": { "h": 9, @@ -1284,9 +1349,10 @@ "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", @@ -1301,6 +1367,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "cars", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -1318,7 +1401,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1391,13 +1474,15 @@ "fields": "", "values": false }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -1429,7 +1514,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1489,13 +1574,15 @@ "fields": "/^version$/", "values": true }, - "textMode": "value" + "showPercentChange": false, + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -1529,7 +1616,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1641,7 +1728,7 @@ "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -1674,16 +1761,14 @@ "type": "state-timeline" } ], - "refresh": "30s", - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": ["TeslamateCustomDashboards"], "templating": { "list": [ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", @@ -1706,7 +1791,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select base_url from settings limit 1;", @@ -1729,7 +1814,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_length from settings limit 1;", @@ -1748,7 +1833,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_temperature from settings limit 1;", @@ -1767,7 +1852,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select preferred_range from settings limit 1;", @@ -1786,7 +1871,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_pressure from settings limit 1;", @@ -1836,6 +1921,6 @@ "timezone": "", "title": "Current State", "uid": "jchmo4BNRkZz", - "version": 11, + "version": 12, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/DCChargingCurvesByCarrier.json b/charts/incubator/teslamate/dashboards/teslamate2/DCChargingCurvesByCarrier.json index 427731fac92..e44ae31b6f6 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/DCChargingCurvesByCarrier.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/DCChargingCurvesByCarrier.json @@ -5,11 +5,11 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.1.2" + "version": "10.4.0" }, { "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "name": "PostgreSQL", "version": "1.0.0" }, @@ -44,9 +44,9 @@ "$$hashKey": "object:75", "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": { @@ -96,15 +96,16 @@ "panels": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { "defaults": { "color": { - "mode": "continuous-RdYlGr" + "mode": "continuous-GrYlRd" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -165,7 +166,6 @@ "y": 0 }, "id": 32, - "links": [], "options": { "legend": { "calcs": [], @@ -210,7 +210,7 @@ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", @@ -257,7 +257,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -292,7 +292,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -337,11 +337,11 @@ }, "showHeader": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -374,7 +374,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -417,7 +417,6 @@ "y": 16 }, "id": 35, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -429,13 +428,15 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -465,13 +466,12 @@ } ], "title": "Avg. Energy Added", - "transformations": [], "transparent": true, "type": "stat" }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -514,7 +514,6 @@ "y": 16 }, "id": 36, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -526,13 +525,15 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -562,13 +563,12 @@ } ], "title": "Avg. Energy Used", - "transformations": [], "transparent": true, "type": "stat" }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -611,7 +611,6 @@ "y": 16 }, "id": 34, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -623,13 +622,15 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -659,13 +660,12 @@ } ], "title": "Avg. Time", - "transformations": [], "transparent": true, "type": "stat" }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -707,7 +707,6 @@ "y": 16 }, "id": 37, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -719,13 +718,15 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -755,13 +756,12 @@ } ], "title": "Avg. Cost", - "transformations": [], "transparent": true, "type": "stat" }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -803,7 +803,6 @@ "y": 16 }, "id": 38, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "none", @@ -815,13 +814,15 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -851,12 +852,11 @@ } ], "title": "Avg. Cost per kWh", - "transformations": [], "transparent": true, "type": "stat" }, { - "collapsed": true, + "collapsed": false, "gridPos": { "h": 1, "w": 24, @@ -864,78 +864,76 @@ "y": 20 }, "id": 42, - "panels": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "gridPos": { - "h": 3, - "w": 24, - "x": 0, - "y": 21 - }, - "id": 40, - "options": { - "code": { - "language": "plaintext", - "showLineNumbers": false, - "showMiniMap": false - }, - "content": "#### DC Charing curves by Carrier\n\nTo analyse data with this dashboard, it's important that you \nhave Geo-Fences added related with the name of the carrier\nyou have recharged your car, or you may want to edit \nperiodically the **name** field of the **addresses** table,\nso that it contains its name. \n\nFor example, if **Teslamate** geolocates the name as \n*\"Esso Purley Way\"* you may modify it to \n*\"Esso Purley Way - IONITY\"* or *\"IONITY Esso Purley Way\"*, \nthen you can filter using\nthe textbox above as **IONITY** to show all the charging curves\nof all charging sessions at that carrier.", - "mode": "markdown" - }, - "pluginVersion": "10.1.2", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "TeslaMate" - }, - "format": "time_series", - "group": [], - "metricColumn": "none", - "rawQuery": false, - "rawSql": "SELECT\n start_date AS \"time\",\n start_km\nFROM drives\nWHERE\n $__timeFilter(start_date)\nORDER BY 1", - "refId": "A", - "select": [ - [ - { - "params": ["start_km"], - "type": "column" - } - ] - ], - "table": "drives", - "timeColumn": "start_date", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "type": "text" - } - ], + "panels": [], "title": "Help", "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 21 + }, + "id": 40, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "#### DC Charing curves by Carrier\n\nTo analyse data with this dashboard, it's important that you \nhave Geo-Fences added related with the name of the carrier\nyou have recharged your car, or you may want to edit \nperiodically the **name** field of the **addresses** table,\nso that it contains its name. \n\nFor example, if **Teslamate** geolocates the name as \n*\"Esso Purley Way\"* you may modify it to \n*\"Esso Purley Way - IONITY\"* or *\"IONITY Esso Purley Way\"*, \nthen you can filter using\nthe textbox above as **IONITY** to show all the charging curves\nof all charging sessions at that carrier.", + "mode": "markdown" + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": false, + "rawSql": "SELECT\n start_date AS \"time\",\n start_km\nFROM drives\nWHERE\n $__timeFilter(start_date)\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": ["start_km"], + "type": "column" + } + ] + ], + "table": "drives", + "timeColumn": "start_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "type": "text" } ], "refresh": "", - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": ["TeslamateCustomDashboards"], "templating": { "list": [ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", @@ -958,7 +956,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select base_url from settings limit 1;", @@ -1021,6 +1019,6 @@ "timezone": "", "title": "DC Charging Curves by Carrier", "uid": "jchmXpkcccIkh", - "version": 6, + "version": 7, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/DatabaseDashboadInfo.json b/charts/incubator/teslamate/dashboards/teslamate2/DatabaseDashboadInfo.json index 1607e0f4915..ee265766f02 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/DatabaseDashboadInfo.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/DatabaseDashboadInfo.json @@ -1140,7 +1140,7 @@ "format": "table", "hide": false, "rawQuery": true, - "rawSql": "SELECT '2024.04.02' AS \"Current Version\"", + "rawSql": "SELECT '2024.04.17' AS \"Current Version\"", "refId": "DashboardVersion", "sql": { "columns": [ diff --git a/charts/incubator/teslamate/dashboards/teslamate2/MileageStats.json b/charts/incubator/teslamate/dashboards/teslamate2/MileageStats.json index 27ca8a4fe6f..6e9ceb28d36 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/MileageStats.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/MileageStats.json @@ -11,11 +11,11 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.1.2" + "version": "10.4.0" }, { "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "name": "PostgreSQL", "version": "1.0.0" }, @@ -31,9 +31,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": { @@ -97,7 +97,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", @@ -329,12 +329,12 @@ } ] }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "repeatDirection": "h", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -491,7 +491,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "With this dashboard you may analize your mileage and number of drives by year, month, week or day.\n\nThe dashboard shows a table with the selected period, time driven, distance, number of drives and efficiency then a bar chart to have a better look for comparison.", @@ -501,6 +501,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -621,9 +622,10 @@ "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", @@ -638,6 +640,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -656,7 +675,12 @@ "id": "filterFieldsByName", "options": { "include": { - "names": ["sum_distance_km", "cnt", "Period"] + "names": [ + "Period", + "sum_distance_mi", + "cnt", + "sum_distance_km" + ] } } } @@ -665,15 +689,14 @@ } ], "refresh": "", - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": ["TeslamateCustomDashboards"], "templating": { "list": [ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", @@ -696,7 +719,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_length from settings limit 1;", @@ -719,7 +742,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select base_url from settings limit 1;", @@ -741,7 +764,7 @@ }, { "current": { - "selected": true, + "selected": false, "text": "month", "value": "month" }, @@ -811,6 +834,6 @@ "timezone": "", "title": "Mileage Stats", "uid": "jchmNjtMTFx", - "version": 4, + "version": 5, "weekStart": "" } diff --git a/charts/incubator/teslamate/dashboards/teslamate2/TrackingDrives.json b/charts/incubator/teslamate/dashboards/teslamate2/TrackingDrives.json index 47a5a0d8b45..e428dbf890c 100644 --- a/charts/incubator/teslamate/dashboards/teslamate2/TrackingDrives.json +++ b/charts/incubator/teslamate/dashboards/teslamate2/TrackingDrives.json @@ -11,11 +11,11 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.1.2" + "version": "10.4.0" }, { "type": "datasource", - "id": "postgres", + "id": "grafana-postgresql-datasource", "name": "PostgreSQL", "version": "1.0.0" }, @@ -41,9 +41,9 @@ "type": "datasource", "uid": "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": { @@ -93,7 +93,7 @@ "panels": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "This dashboard is meant to analize a drive based on a date you select, then you can pass the pointer over the lines in graph to see data details and a blue point in the map tranking the route. With this option you can analized a specific point location in the map, to see the speed, power, SOC, elevation and if battery heater was on.\n\nBe aware that the drive you select in the dropdown list from the top could be outside the time range of the Timeline graph, if its the case you have to click on the \"Zoom to data\" button on the graph in order to update it.\n\nTip: On Grafana you can press \"h\" to get a keyboard shortcuts if you want to change the current Zoom out time range or use the mouse to select/change the time range.", @@ -103,10 +103,11 @@ "mode": "palette-classic" }, "custom": { - "axisCenteredZero": false, + "axisBorderShow": false, + "axisCenteredZero": true, "axisColorMode": "text", "axisLabel": "", - "axisPlacement": "auto", + "axisPlacement": "left", "barAlignment": 0, "drawStyle": "line", "fillOpacity": 0, @@ -117,7 +118,7 @@ "viz": false }, "insertNulls": false, - "lineInterpolation": "linear", + "lineInterpolation": "smooth", "lineWidth": 1, "pointSize": 5, "scaleDistribution": { @@ -175,18 +176,6 @@ } ] }, - { - "matcher": { - "id": "byName", - "options": "elevation_m" - }, - "properties": [ - { - "id": "displayName", - "value": "Elevation (m)" - } - ] - }, { "matcher": { "id": "byName", @@ -220,6 +209,13 @@ { "id": "displayName", "value": "SOC (%)" + }, + { + "id": "color", + "value": { + "fixedColor": "purple", + "mode": "fixed" + } } ] }, @@ -238,36 +234,6 @@ } ] }, - { - "matcher": { - "id": "byName", - "options": "Elevation" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "#ccccdc", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Elevation (m)" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "text", - "mode": "fixed" - } - } - ] - }, { "matcher": { "id": "byName", @@ -285,93 +251,48 @@ }, { "matcher": { - "id": "byName", - "options": "Rated Efficiency (kWh/100km)" + "id": "byRegexp", + "options": "/elevation_*/" }, "properties": [ { - "id": "color", - "value": { - "fixedColor": "dark-green", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "SOC (%)" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "light-purple", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Speed (km/h)" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "light-blue", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "speed_kmh" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "light-blue", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Elevation" - }, - "properties": [ - { - "id": "decimals", - "value": 0 + "id": "displayName", + "value": "Elevation" }, { - "id": "min", - "value": 0 + "id": "color", + "value": { + "fixedColor": "text", + "mode": "fixed" + } + }, + { + "id": "custom.axisPlacement", + "value": "right" } ] }, { "matcher": { "id": "byName", - "options": "Elevation (m)" + "options": "elevation_ft" }, "properties": [ { - "id": "decimals", - "value": 0 - }, + "id": "unit", + "value": "lengthft" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "elevation_m" + }, + "properties": [ { - "id": "min", - "value": 0 + "id": "unit", + "value": "lengthm" } ] } @@ -385,7 +306,6 @@ }, "hideTimeOverride": false, "id": 8, - "links": [], "options": { "legend": { "calcs": [], @@ -403,9 +323,10 @@ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "time_series", "group": [], "hide": false, @@ -421,6 +342,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charging", "timeColumn": "Datum", "timeColumnType": "timestamp", @@ -438,14 +376,14 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { "defaults": { "color": { "fixedColor": "red", - "mode": "thresholds" + "mode": "fixed" }, "custom": { "hideFrom": { @@ -474,13 +412,14 @@ "y": 0 }, "id": 18, - "links": [], "maxDataPoints": 50000, "options": { "basemap": { - "config": {}, + "config": { + "server": "streets" + }, "name": "Layer 0", - "type": "osm-standard" + "type": "esri-xyz" }, "controls": { "mouseWheelZoom": true, @@ -513,7 +452,7 @@ }, "symbol": { "field": "", - "fixed": "", + "fixed": "img/icons/marker/triangle.svg", "mode": "fixed" }, "symbolAlign": { @@ -539,7 +478,7 @@ } ], "tooltip": { - "mode": "details" + "mode": "none" }, "view": { "allLayers": true, @@ -549,12 +488,12 @@ "zoom": 15 } }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "alias": "", "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", @@ -632,7 +571,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", @@ -695,6 +634,22 @@ "value": "Wh/km" } ] + }, + { + "matcher": { + "id": "byName", + "options": "mi" + }, + "properties": [ + { + "id": "displayName", + "value": "Consumption" + }, + { + "id": "unit", + "value": "Wh/mi" + } + ] } ] }, @@ -705,7 +660,6 @@ "y": 17 }, "id": 14, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -717,16 +671,18 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": { "titleSize": 16 }, - "textMode": "value_and_name" + "textMode": "value_and_name", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -734,7 +690,7 @@ "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT ((DATE_PART('day', end_date - start_date) * 24 + \n DATE_PART('hour', end_date - start_date)) * 60 +\n DATE_PART('minute', end_date - start_date)) * 60 +\n DATE_PART('second', end_date - start_date) as sec_diff\nFROM drives\nWHERE drives.id = $journey;", - "refId": "A", + "refId": "Duration", "select": [ [ { @@ -756,16 +712,17 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "select\n\t(NULLIF(GREATEST(start_[[preferred_range]]_range_km - end_[[preferred_range]]_range_km, 0), 0) * car.efficiency) *1000 /\n\t convert_km(distance::numeric, '$length_unit') as \"$length_unit\"\nfrom drives d\nJOIN cars car ON car.id = car_id\nwhere d.id = $journey;", - "refId": "Distance", + "refId": "Consumption", "select": [ [ { @@ -774,6 +731,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -790,7 +764,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", @@ -860,7 +834,7 @@ "properties": [ { "id": "unit", - "value": "velocitymih" + "value": "velocitymph" }, { "id": "displayName", @@ -893,7 +867,6 @@ "y": 17 }, "id": 12, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -905,16 +878,18 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": { "titleSize": 16 }, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -922,7 +897,7 @@ "metricColumn": "none", "rawQuery": true, "rawSql": "select convert_km(distance::numeric, '$length_unit') as \"$length_unit\" from drives where id = $journey;", - "refId": "A", + "refId": "Distance", "select": [ [ { @@ -944,7 +919,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -953,7 +928,7 @@ "metricColumn": "none", "rawQuery": true, "rawSql": "WITH journey AS (SELECT start_date, end_date FROM drives WHERE id = $journey)\nSELECT\n\tAVG(convert_km(speed::numeric, '$length_unit')) AS speed_[[length_unit]]h\nFROM\n\tpositions, journey\nWHERE\n car_id = $car_id AND (date BETWEEN journey.start_date AND journey.end_date)", - "refId": "B", + "refId": "Speed", "select": [ [ { @@ -978,7 +953,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1016,7 +991,6 @@ "y": 17 }, "id": 16, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -1028,16 +1002,18 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": { "titleSize": 16 }, - "textMode": "value" + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "format": "table", @@ -1071,7 +1047,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "fieldConfig": { @@ -1109,23 +1085,26 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": { "titleSize": 16 }, - "textMode": "value_and_name" + "textMode": "value_and_name", + "wideLayout": true }, - "pluginVersion": "10.1.2", + "pluginVersion": "10.4.0", "targets": [ { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH height as (SELECT\n\televation-LAG(elevation,1) over ( order BY\n\tdate ASC ) as diff\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND (date BETWEEN (SELECT start_date FROM drives WHERE id = $journey) AND (SELECT end_date FROM drives WHERE id = $journey))\nORDER BY\n\tdate ASC\n\t)\nselect convert_m(sum(diff), '$alternative_length_unit') || ' $alternative_length_unit' as \"Up\" from height where diff > 0", + "rawSql": "WITH height as (SELECT\n\televation-LAG(elevation,1) over ( order BY\n\tdate ASC ) as diff\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND (date BETWEEN (SELECT start_date FROM drives WHERE id = $journey) AND (SELECT end_date FROM drives WHERE id = $journey))\nORDER BY\n\tdate ASC\n\t)\nselect ROUND(convert_m(sum(diff), '$alternative_length_unit')::numeric,0) || ' $alternative_length_unit' as \"Up\" from height where diff > 0", "refId": "A", "select": [ [ @@ -1135,6 +1114,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -1148,15 +1144,16 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH height as (SELECT\n\televation-LAG(elevation,1) over ( order BY\n\tdate ASC ) as diff\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND (date BETWEEN (SELECT start_date FROM drives WHERE id = $journey) AND (SELECT end_date FROM drives WHERE id = $journey))\nORDER BY\n\tdate ASC\n\t)\n\t\n\t\nselect convert_m(sum(diff), '$alternative_length_unit') || ' $alternative_length_unit' as \"Down\" from height where diff < 0", + "rawSql": "WITH height as (SELECT\n\televation-LAG(elevation,1) over ( order BY\n\tdate ASC ) as diff\nFROM\n\tpositions\nWHERE\n car_id = $car_id AND (date BETWEEN (SELECT start_date FROM drives WHERE id = $journey) AND (SELECT end_date FROM drives WHERE id = $journey))\nORDER BY\n\tdate ASC\n\t)\n\t\n\t\nselect ROUND(convert_m(sum(diff), '$alternative_length_unit')::numeric,0) || ' $alternative_length_unit' as \"Down\" from height where diff < 0", "refId": "B", "select": [ [ @@ -1166,6 +1163,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -1183,15 +1197,14 @@ } ], "refresh": "", - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": ["TeslamateCustomDashboards"], "templating": { "list": [ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select unit_of_length from settings limit 1;", @@ -1210,7 +1223,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select case when unit_of_length = 'km' then 'm' when unit_of_length = 'mi' then 'ft' end from settings limit 1;", @@ -1229,7 +1242,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;", @@ -1252,7 +1265,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT TO_CHAR(start_date, 'YYYY') as year FROM drives\nWHERE car_id = $car_id\nGROUP BY 1\nORDER BY 1 DESC;", @@ -1271,7 +1284,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "(SELECT TO_CHAR(start_date, 'MM') as month FROM drives WHERE car_id = $car_id ORDER BY start_date DESC LIMIT 1)\nUNION ALL\n(SELECT TO_CHAR(start_date, 'MM') as month FROM drives WHERE car_id = $car_id AND TO_CHAR(start_date, 'YYYY') = '$Year'\nGROUP BY 1\nORDER BY 1);", @@ -1290,7 +1303,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "(SELECT TO_CHAR(start_date, 'DD') as day FROM drives WHERE car_id = $car_id ORDER BY start_date DESC LIMIT 1)\nUNION ALL\n(SELECT TO_CHAR(start_date, 'DD') as day FROM drives \nWHERE car_id = $car_id AND TO_CHAR(start_date, 'YYYY') = '$Year' AND TO_CHAR(start_date, 'MM') = '$Month'\nGROUP BY 1 ORDER BY 1);", @@ -1309,7 +1322,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "WITH data AS (\n SELECT\n drives.id as drive_id,\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 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 drives.car_id = $car_id AND start_date::date = '$Year-$Month-$Day' AND distance > 0 \n ORDER BY start_date DESC\n)\nSELECT\n 'route=\"' || to_char(start_date:: timestamp, 'YYYY-MM-DD') || ' ' || start_address || ' ---> ' || end_address || '\" id=\"' || drive_id || '\"'AS journey\nFROM data;", @@ -1329,7 +1342,7 @@ { "current": {}, "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "select preferred_range from settings limit 1;", @@ -1348,8 +1361,8 @@ ] }, "time": { - "from": "2023-11-28T12:32:29.961Z", - "to": "2023-11-28T12:40:33.863Z" + "from": "now-15m", + "to": "now" }, "timepicker": { "hidden": true, @@ -1358,6 +1371,6 @@ "timezone": "", "title": "Tracking Drives", "uid": "jchmX8upc6ZRk", - "version": 3, + "version": 6, "weekStart": "" } diff --git a/charts/incubator/teslamate/questions.yaml b/charts/incubator/teslamate/questions.yaml index fcb72234322..1a318d15eb3 100644 --- a/charts/incubator/teslamate/questions.yaml +++ b/charts/incubator/teslamate/questions.yaml @@ -10,50 +10,50 @@ questions: # Include{replicas1} # Include{podSpec} # Include{containerMain} - - variable: env - label: "Image Environment" - schema: - additional_attrs: true - type: dict - attrs: - - variable: DISABLE_MQTT - label: "Mqtt Disabled" - description: "Disables the MQTT feature if true" - schema: - type: boolean - default: true - - variable: MQTT_HOST - label: "Mqtt Host" - description: "Hostname of the broker." - schema: - type: string - default: "" - show_if: [["DISABLE_MQTT", "=", false]] - - variable: MQTT_PORT - label: "Mqtt Port" - schema: - type: int - default: 1883 - show_if: [["DISABLE_MQTT", "=", false]] - - variable: MQTT_USERNAME - label: "Mqtt Username" - description: "Username of the broker." - schema: - type: string - default: "" - show_if: [["DISABLE_MQTT", "=", false]] - - variable: MQTT_PASSWORD - label: "Mqtt Password" - description: "Password of the broker." - schema: - type: string - private: true - show_if: [["DISABLE_MQTT", "=", false]] - # Include{containerBasic} # Include{containerAdvanced} # Include{containerConfig} # Include{podOptions} + - variable: env + group: "App Configuration" + label: "Image Environment" + schema: + additional_attrs: true + type: dict + attrs: + - variable: DISABLE_MQTT + label: "Mqtt Disabled" + description: "Disables the MQTT feature if true" + schema: + type: boolean + default: true + - variable: MQTT_HOST + label: "Mqtt Host" + description: "Hostname of the broker." + schema: + type: string + default: "" + show_if: [["DISABLE_MQTT", "=", false]] + - variable: MQTT_PORT + label: "Mqtt Port" + schema: + type: int + default: 1883 + show_if: [["DISABLE_MQTT", "=", false]] + - variable: MQTT_USERNAME + label: "Mqtt Username" + description: "Username of the broker." + schema: + type: string + default: "" + show_if: [["DISABLE_MQTT", "=", false]] + - variable: MQTT_PASSWORD + label: "Mqtt Password" + description: "Password of the broker." + schema: + type: string + private: true + show_if: [["DISABLE_MQTT", "=", false]] # Include{serviceRoot} - variable: main label: "Main Service" @@ -80,8 +80,6 @@ questions: # Include{externalInterfaces} # Include{serviceList} -# Include{persistenceRoot} -# Include{persistenceBasic} # Include{persistenceList} # Include{ingressRoot} - variable: main @@ -116,11 +114,10 @@ questions: type: int default: 568 # Include{resources} -# Include{metrics} -# Include{prometheusRule} +# Include{postgresql} # Include{advanced} # Include{addons} # Include{codeserver} -# Include{netshoot} # Include{vpn} +# Include{netshoot} # Include{documentation} diff --git a/charts/incubator/teslamate/values.yaml b/charts/incubator/teslamate/values.yaml index dc76692a496..8b1e68cf59c 100644 --- a/charts/incubator/teslamate/values.yaml +++ b/charts/incubator/teslamate/values.yaml @@ -1,7 +1,7 @@ image: repository: teslamate/teslamate pullPolicy: IfNotPresent - tag: 1.28.5@sha256:aa3f37ecccc7ea77fa1e259391c8f2a05533e208228a42ebb4dbe560828db057 + tag: 1.29.1@sha256:7c833ef13585b46339b778bb974fa6ea0f908cb7b9d1a62b41aef694bfdb9ca0 securityContext: container: