From c8c9bee8211706bc77c66e87629e70e4b8fdcdb3 Mon Sep 17 00:00:00 2001 From: Christian Pogea Date: Wed, 2 Oct 2024 23:06:34 +0200 Subject: [PATCH] Trip monthly statistics with yearly statistics --- TeslaLogger/Grafana/Trip Monatsstatistik.json | 301 +++++++++++++++++- 1 file changed, 290 insertions(+), 11 deletions(-) diff --git a/TeslaLogger/Grafana/Trip Monatsstatistik.json b/TeslaLogger/Grafana/Trip Monatsstatistik.json index c03712848..c73424b25 100644 --- a/TeslaLogger/Grafana/Trip Monatsstatistik.json +++ b/TeslaLogger/Grafana/Trip Monatsstatistik.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -12,7 +15,7 @@ "limit": 100, "matchAny": false, "tags": [], - "type": "dashboard" + "type": "dashboard" }, "type": "dashboard" } @@ -21,7 +24,6 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "iteration": 1664891370966, "links": [ { "icon": "external link", @@ -47,7 +49,10 @@ }, "custom": { "align": "auto", - "displayMode": "auto" + "cellOptions": { + "type": "auto" + }, + "inspect": false }, "mappings": [], "thresholds": { @@ -221,18 +226,68 @@ "id": "custom.align" } ] + }, + { + "matcher": { + "id": "byName", + "options": "Jahr/Monat" + }, + "properties": [ + { + "id": "custom.width", + "value": 125 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Ø Verbrauch [kWh]" + }, + "properties": [ + { + "id": "custom.width", + "value": 163 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Verbrauch [kWh]" + }, + "properties": [ + { + "id": "custom.width", + "value": 166 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Ø °C" + }, + "properties": [ + { + "id": "custom.width", + "value": 117 + } + ] } ] }, "gridPos": { "h": 15, - "w": 14, + "w": 10, "x": 0, "y": 0 }, "id": 2, "options": { + "cellHeight": "sm", "footer": { + "countRows": false, "fields": [ "sum_duration_h", "sum_consumption_kwh", @@ -249,12 +304,16 @@ { "desc": true, "displayName": "Jahr/Monat" - } + } ] }, - "pluginVersion": "8.3.2", + "pluginVersion": "10.0.1", "targets": [ { + "datasource": { + "type": "mysql", + "uid": "000000001" + }, "format": "table", "group": [], "metricColumn": "none", @@ -293,17 +352,237 @@ } ], "type": "table" + }, + { + "datasource": { + "type": "mysql", + "uid": "000000001" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "decimals": 1, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "date" + }, + "properties": [ + { + "id": "custom.width", + "value": 100 + }, + { + "id": "displayName", + "value": "Jahr" + }, + { + "id": "custom.align", + "value": "left" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.minWidth", + "value": 100 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "sum_duration_h" + }, + "properties": [ + { + "id": "custom.width", + "value": 174 + }, + { + "id": "displayName", + "value": "Fahrzeit [h]" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "sum_km" + }, + "properties": [ + { + "id": "custom.width", + "value": 158 + }, + { + "id": "displayName", + "value": "Strecke [km]" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "sum_consumption_kwh" + }, + "properties": [ + { + "id": "custom.width", + "value": 168 + }, + { + "id": "displayName", + "value": "Verbrauch [kWh]" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "avg_consumption_kwh" + }, + "properties": [ + { + "id": "custom.width", + "value": 170 + }, + { + "id": "displayName", + "value": "Ø Verbrauch [kWh]" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "avg_outside_temp" + }, + "properties": [ + { + "id": "custom.width", + "value": 105 + }, + { + "id": "displayName", + "value": "Ø °C" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "cnt" + }, + "properties": [ + { + "id": "displayName", + "value": "Anzahl Trips" + }, + { + "id": "decimals", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 10, + "x": 0, + "y": 15 + }, + "id": 3, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": [ + "sum_duration_h", + "sum_km", + "sum_consumption_kwh", + "cnt" + ], + "reducer": [ + "sum" + ], + "show": true + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "10.0.1", + "targets": [ + { + "datasource": { + "type": "mysql", + "uid": "000000001" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT year(StartDate) as date, \r\nsum(DurationMinutes)/60 as sum_duration_h, \r\nsum(km_diff) as sum_km,\r\nsum(consumption_kWh) as sum_consumption_kwh, \r\nsum(consumption_kWh) / sum(km_diff) * 100 as avg_consumption_kwh,\r\navg(outside_temp_avg) as avg_outside_temp,\r\ncount(*) as cnt\r\nfrom trip WHERE \r\n km_diff < 1000 and CarID = $Car \r\n group by year(StartDate)\r\n\r\norder by date desc\r\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Trip Jahresstatistik", + "type": "table" } ], - "schemaVersion": 33, + "refresh": false, + "schemaVersion": 38, "style": "dark", "tags": [], "templating": { "list": [ { "current": { - "selected": false, - "text": "Two weeks", + "selected": true, + "text": "Teslarossa", "value": "1" }, "datasource": { @@ -350,6 +629,6 @@ "timezone": "", "title": "Trip Monatsstatistik", "uid": "YmpLrqZRz", - "version": 6, + "version": 29, "weekStart": "" } \ No newline at end of file