{ "annotations": { "list": [ { "builtIn": 1, "datasource": { "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)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 1, "links": [ { "icon": "dashboard", "tags": [], "title": "TeslaMate", "tooltip": "", "type": "link", "url": "${base_url:raw}" }, { "asDropdown": true, "icon": "external link", "tags": [ "tesla" ], "title": "Dashboards", "type": "dashboards" }, { "asDropdown": true, "icon": "external link", "includeVars": false, "keepTime": false, "tags": [ "TeslamateCustomDashboards" ], "targetBlank": false, "title": "Custom Dashboards", "tooltip": "", "type": "dashboards", "url": "" } ], "panels": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, "insertNulls": false, "lineInterpolation": "smooth", "lineWidth": 1, "pointSize": 5, "scaleDistribution": { "type": "linear" }, "showPoints": "never", "spanNulls": false, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] }, "unit": "locale" }, "overrides": [ { "matcher": { "id": "byRegexp", "options": "/.avg*/" }, "properties": [ { "id": "color", "value": { "fixedColor": "red", "mode": "fixed" } }, { "id": "custom.showPoints", "value": "always" } ] }, { "matcher": { "id": "byRegexp", "options": "/Odometer/" }, "properties": [ { "id": "custom.axisPlacement", "value": "right" } ] }, { "matcher": { "id": "byName", "options": "range" }, "properties": [ { "id": "displayName", "value": "Max ${preferred_range} range [${length_unit}]" }, { "id": "custom.fillOpacity", "value": 20 } ] } ] }, "gridPos": { "h": 17, "w": 18, "x": 0, "y": 0 }, "id": 38, "options": { "legend": { "calcs": [ "max", "min" ], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "hideZeros": false, "maxHeight": 600, "mode": "multi", "sort": "none" } }, "pluginVersion": "11.5.2", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", "format": "time_series", "hide": false, "rawQuery": true, "rawSql": "SELECT $__time(cp.start_date), \r\n convert_km((cp.end_${preferred_range}_range_km / cp.end_battery_level * 100)::numeric,'$length_unit') AS \"range\",\r\n convert_km(p.odometer::numeric,'$length_unit') AS \"Odometer [${length_unit}]\"\r\nFROM charging_processes cp\r\n INNER JOIN positions p ON cp.position_id = p.id\r\nWHERE $__timeFilter(cp.start_date) and cp.car_id = $car_id\r\nand cp.duration_min > 10 \r\nORDER by cp.start_date\r\n", "refId": "A", "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 } }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", "format": "time_series", "hide": false, "rawQuery": true, "rawSql": "SELECT $__timeGroup(cp.start_date, $interval) AS time, \r\n AVG(convert_km((cp.end_${preferred_range}_range_km / cp.end_battery_level * 100)::numeric,'$length_unit')) AS \"Max ${preferred_range} range ($interval avg) [${length_unit}]\"\r\nFROM charging_processes cp\r\nWHERE $__timeFilter(cp.start_date) and cp.car_id = $car_id\r\nand cp.duration_min > 10 \r\nGROUP BY 1\r\nORDER BY 1", "refId": "B", "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 } } ], "title": "Range Degradation", "type": "timeseries" }, { "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": 7, "w": 6, "x": 18, "y": 0 }, "id": 37, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "/.*/", "values": false }, "showPercentChange": false, "textMode": "value_and_name", "wideLayout": true }, "pluginVersion": "11.5.2", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", "format": "table", "hide": false, "rawQuery": true, "rawSql": "select ROUND(convert_km(sum(distance)::numeric, '$length_unit'),0)|| ' $length_unit' as \"Logged\"\r\nfrom drives \r\nwhere car_id = $car_id AND $__timeFilter(start_date)\r\n", "refId": "Looged", "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 ROUND(convert_km((max(end_km) - min(start_km))::numeric, '$length_unit'),0)|| ' $length_unit' as \"Mileage\"\nFROM drives WHERE car_id = $car_id AND $__timeFilter(start_date)", "refId": "Mileage", "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 (SELECT ROUND(convert_km((max(end_km) - min(start_km))::numeric, '$length_unit'),0) FROM drives WHERE car_id = $car_id AND $__timeFilter(start_date)) - \r\n (SELECT ROUND(convert_km(sum(distance)::numeric, '$length_unit'),0) from drives where car_id = $car_id AND $__timeFilter(start_date)) || ' $length_unit'\r\n)\r\nAS \"Data lost (not logged)\"\r\n", "refId": "A", "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 } } ], "title": "Trips (this period)", "type": "stat" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "description": "", "fieldConfig": { "defaults": { "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": 10, "w": 6, "x": 18, "y": 7 }, "id": 36, "maxDataPoints": 100, "options": { "colorMode": "value", "fieldOptions": { "calcs": [ "mean" ] }, "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "value_and_name", "wideLayout": true }, "pluginVersion": "11.5.2", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "editorMode": "code", "format": "table", "hide": false, "rawQuery": true, "rawSql": "SELECT\r\n\tCOUNT(*) AS \"# of Charges\"\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\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": [], "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 } } ], "title": "Battery Stats (this period)", "type": "stat" } ], "preload": false, "refresh": "", "schemaVersion": 40, "tags": [ "TeslamateCustomDashboards" ], "templating": { "list": [ { "current": {}, "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC", "includeAll": false, "label": "Car", "name": "car_id", "options": [], "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC", "refresh": 1, "regex": "", "type": "query" }, { "current": {}, "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT unit_of_length FROM settings LIMIT 1", "hide": 2, "includeAll": false, "name": "length_unit", "options": [], "query": "SELECT unit_of_length FROM settings LIMIT 1", "refresh": 1, "regex": "", "type": "query" }, { "current": {}, "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT preferred_range FROM settings LIMIT 1", "hide": 2, "includeAll": false, "name": "preferred_range", "options": [], "query": "SELECT preferred_range FROM settings LIMIT 1", "refresh": 1, "regex": "", "type": "query" }, { "current": {}, "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, "definition": "SELECT base_url FROM settings LIMIT 1", "hide": 2, "includeAll": false, "name": "base_url", "options": [], "query": "SELECT base_url FROM settings LIMIT 1", "refresh": 1, "regex": "", "type": "query" }, { "current": { "text": "15d", "value": "15d" }, "includeAll": false, "label": "Interval AVG", "name": "interval", "options": [ { "selected": false, "text": "1d", "value": "1d" }, { "selected": false, "text": "7d", "value": "7d" }, { "selected": true, "text": "15d", "value": "15d" }, { "selected": false, "text": "30d", "value": "30d" } ], "query": "1d,7d,15d,30d ", "type": "custom" } ] }, "time": { "from": "now-6M", "to": "now" }, "timepicker": {}, "timezone": "browser", "title": "Range Degradation", "uid": "jchmRiqUfXgm", "version": 1, "weekStart": "" }