TrueChartsClone/charts/incubator/teslamate/dashboards/teslamate2/CurrentChargeView.json

1954 lines
70 KiB
JSON

{
"__elements": {},
"__requires": [
{
"type": "panel",
"id": "bargauge",
"name": "Bar gauge",
"version": ""
},
{
"type": "panel",
"id": "gauge",
"name": "Gauge",
"version": ""
},
{
"type": "panel",
"id": "geomap",
"name": "Geomap",
"version": ""
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "10.1.2"
},
{
"type": "datasource",
"id": "postgres",
"name": "PostgreSQL",
"version": "1.0.0"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "text",
"name": "Text",
"version": ""
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "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": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [
{
"asDropdown": true,
"icon": "external link",
"includeVars": false,
"keepTime": false,
"tags": ["Custom"],
"targetBlank": false,
"title": "Dashboards",
"tooltip": "",
"type": "dashboards",
"url": ""
},
{
"asDropdown": true,
"icon": "external link",
"includeVars": false,
"keepTime": false,
"tags": ["TeslamateCustomDashboards"],
"targetBlank": false,
"title": "Custom Dashboards",
"tooltip": "",
"type": "dashboards",
"url": ""
},
{
"asDropdown": false,
"icon": "info",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": false,
"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}"
}
],
"liveNow": false,
"panels": [
{
"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": 2,
"w": 6,
"x": 0,
"y": 0
},
"id": 8,
"options": {
"displayMode": "lcd",
"minVizHeight": 10,
"minVizWidth": 0,
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"showUnfilled": true,
"text": {
"valueSize": 40
},
"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 as \"SOC [%]\" FROM charges c join charging_processes p ON p.id = c.charging_process_id WHERE $__timeFilter(date) AND p.car_id = $car_id ORDER BY c.ID DESC LIMIT 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": 2,
"w": 6,
"x": 6,
"y": 0
},
"id": 33,
"options": {
"displayMode": "gradient",
"minVizHeight": 10,
"minVizWidth": 0,
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "/^kWh$/",
"values": false
},
"showUnfilled": true,
"text": {
"valueSize": 40
},
"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 * $BatteryCapacity / 100 as \"kWh\", $BatteryCapacity AS Total FROM charges c join charging_processes p ON p.id = c.charging_process_id WHERE $__timeFilter(date) AND p.car_id = $car_id ORDER BY c.ID DESC LIMIT 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"
},
"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.",
"gridPos": {
"h": 4,
"w": 3,
"x": 12,
"y": 0
},
"id": 51,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
},
"content": "<center>\n<img src=\"https://raw.githubusercontent.com/jheredianet/Teslamate-CustomGrafanaDashboards/main/screenshots/help/BatteryCharging.gif\"\nstyle=\"max-height: 125px\" />\n</center>",
"mode": "html"
},
"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"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"decimals": 2,
"mappings": [],
"max": 49,
"min": 0,
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "light-orange",
"value": null
}
]
},
"unit": "kwatth"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 3,
"x": 15,
"y": 0
},
"id": 36,
"options": {
"orientation": "auto",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "/^Added$/",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true
},
"pluginVersion": "10.1.2",
"targets": [
{
"alias": "kWh Added",
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "time_series",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(charge_energy_added) as \"Added\" FROM charges WHERE charging_process_id = $charging_processes AND $__timeFilter(date) GROUP BY 1 ",
"refId": "B",
"select": [
[
{
"params": ["start_km"],
"type": "column"
}
]
],
"table": "drives",
"timeColumn": "start_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Added",
"type": "gauge"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "super-light-blue",
"mode": "fixed"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 6,
"x": 18,
"y": 0
},
"id": 37,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "/^coalesce$/",
"values": false
},
"text": {},
"textMode": "value"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT COALESCE(g.name, CONCAT_WS(', ', COALESCE(addresses.name, CONCAT_WS(' ', addresses.road, addresses.house_number)), addresses.city)) FROM \tcharging_processes c \tLEFT JOIN addresses ON addresses.id = c.address_id \tLEFT JOIN geofences g ON g.id = geofence_id WHERE \tc.id = $charging_processes",
"refId": "Voltage",
"select": [
[
{
"params": ["value"],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 51,
"gradientMode": "opacity",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "smooth",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Power [kW]"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "semi-dark-orange",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "SOC [%]"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-blue",
"mode": "fixed"
}
},
{
"id": "custom.axisPlacement",
"value": "right"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Battery heater"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "semi-dark-red",
"mode": "fixed"
}
},
{
"id": "unit",
"value": "bool_on_off"
}
]
}
]
},
"gridPos": {
"h": 20,
"w": 12,
"x": 0,
"y": 2
},
"id": 28,
"options": {
"legend": {
"calcs": ["mean", "min", "max", "last"],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "8.1.2",
"targets": [
{
"alias": "Power [kW]",
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "time_series",
"group": [],
"groupBy": [
{
"params": ["$__interval"],
"type": "time"
},
{
"params": ["none"],
"type": "fill"
}
],
"metricColumn": "none",
"orderByTime": "ASC",
"policy": "default",
"rawQuery": true,
"rawSql": "SELECT $__time(date), battery_level as \"SOC [%]\", (case when charger_phases >= 1 then (case when charger_phases = 2 then 3 when charger_phases = 1 then 1 else 0 end) * charger_actual_current * charger_voltage / 1000.0 else charger_power end) as \"Power [kW]\", (case when battery_heater_on then 10 when battery_heater then 10 else 0 end) as \"Battery heater\" FROM charges c JOIN charging_processes p ON p.id = c.charging_process_id WHERE $__timeFilter(date) and p.car_id = $car_id ORDER BY 1",
"refId": "Power",
"resultFormat": "time_series",
"select": [
[
{
"params": ["start_km"],
"type": "column"
}
]
],
"table": "drives",
"tags": [],
"timeColumn": "start_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "timeseries"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "light-green",
"mode": "fixed"
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 3,
"x": 12,
"y": 4
},
"id": 35,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": ["first"],
"fields": "",
"values": true
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "10.1.2",
"targets": [
{
"alias": "Real",
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "table",
"group": [],
"groupBy": [],
"hide": false,
"measurement": "km",
"metricColumn": "none",
"orderByTime": "ASC",
"policy": "default",
"rawQuery": true,
"rawSql": " SELECT battery_level as \"Initial SOC\" FROM charges \twhere charging_process_id=$charging_processes \tORDER BY DATE ASC \tLIMIT 1",
"refId": "Inital SOC",
"resultFormat": "time_series",
"select": [
[
{
"params": ["start_km"],
"type": "column"
}
]
],
"table": "drives",
"timeColumn": "start_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT battery_level - (SELECT battery_level as \"Added\" FROM charges where charging_process_id=$charging_processes\tORDER BY DATE ASC \tLIMIT 1) as \"Added\" FROM charges c join charging_processes p ON p.id = c.charging_process_id WHERE $__timeFilter(date) AND p.car_id = $car_id ORDER BY c.ID DESC LIMIT 1",
"refId": "A",
"select": [
[
{
"params": ["efficiency"],
"type": "column"
}
]
],
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"decimals": 1,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
}
]
},
"unit": "clocks"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 15,
"y": 4
},
"id": 30,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": ["sum"],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "10.1.2",
"targets": [
{
"alias": "Elapsed Time",
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "table",
"group": [],
"groupBy": [
{
"params": ["$__interval"],
"type": "time"
},
{
"params": ["null"],
"type": "fill"
}
],
"metricColumn": "none",
"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",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": ["utc"],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "red",
"mode": "thresholds"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 14,
"w": 6,
"x": 18,
"y": 4
},
"id": 50,
"links": [],
"maxDataPoints": 50000,
"options": {
"basemap": {
"config": {},
"name": "Layer 0",
"type": "osm-standard"
},
"controls": {
"mouseWheelZoom": true,
"showAttribution": true,
"showDebug": false,
"showMeasure": false,
"showScale": false,
"showZoom": true
},
"layers": [
{
"config": {
"arrow": 0,
"style": {
"color": {
"fixed": "dark-blue"
},
"lineWidth": 2,
"opacity": 1,
"rotation": {
"fixed": 0,
"max": 360,
"min": -360,
"mode": "mod"
},
"size": {
"fixed": 20,
"max": 15,
"min": 2
},
"symbol": {
"field": "",
"fixed": "",
"mode": "fixed"
},
"symbolAlign": {
"horizontal": "center",
"vertical": "center"
},
"textConfig": {
"fontSize": 12,
"offsetX": 0,
"offsetY": 0,
"textAlign": "center",
"textBaseline": "middle"
}
}
},
"location": {
"mode": "auto"
},
"name": "route",
"opacity": 1,
"tooltip": true,
"type": "route"
}
],
"tooltip": {
"mode": "details"
},
"view": {
"allLayers": true,
"id": "fit",
"lat": 0,
"lon": 0,
"zoom": 15
}
},
"pluginVersion": "10.1.2",
"targets": [
{
"alias": "",
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "time_series",
"group": [
{
"params": ["$__interval", "none"],
"type": "time"
}
],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n $__time(date),\n latitude,\n longitude\nFROM positions\nWHERE \n car_id = $car_id AND \n $__timeFilter(date)\nORDER BY \n date ASC",
"refId": "A",
"select": [
[
{
"params": ["lat"],
"type": "column"
},
{
"params": ["avg"],
"type": "aggregate"
},
{
"params": ["lat"],
"type": "alias"
}
],
[
{
"params": ["lng"],
"type": "column"
},
{
"params": ["avg"],
"type": "aggregate"
},
{
"params": ["lat"],
"type": "alias"
}
]
],
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
]
},
"table": "pos",
"timeColumn": "Datum",
"timeColumnType": "datetime",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "geomap"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "super-light-yellow",
"mode": "fixed"
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "Km"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 15,
"y": 7
},
"id": 16,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": ["first"],
"fields": "",
"values": true
},
"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 $__time(date), convert_km(odometer::numeric, '$length_unit') as \"Odometer\" from positions where car_id = $car_id order by date desc limit 1;",
"refId": "odometer",
"resultFormat": "time_series",
"select": [
[
{
"params": ["start_km"],
"type": "column"
}
]
],
"table": "drives",
"timeColumn": "start_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"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",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "light-blue",
"mode": "fixed"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Current"
},
"properties": [
{
"id": "unit",
"value": "amp"
}
]
}
]
},
"gridPos": {
"h": 4,
"w": 3,
"x": 12,
"y": 14
},
"id": 49,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": ["mean"],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "time_series",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(case when charger_voltage > 2 then charger_actual_current else ((2.85 + (usable_battery_level * 0.013)) * 96) * charger_power / 100 end) as \"Current\" FROM charges WHERE charging_process_id = $charging_processes AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 ",
"refId": "Current",
"select": [
[
{
"params": ["value"],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "volt"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 3,
"x": 15,
"y": 14
},
"id": 47,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": ["mean"],
"fields": "/^Volt$/",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "time_series",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(case when charger_voltage > 2 then charger_voltage else charger_power / GREATEST(0.1, (((2.85 + (usable_battery_level * 0.013)) * 96.0) * charger_power / 100.0)) * 1000.0 end) as \"Volt\" FROM charges WHERE charging_process_id = $charging_processes AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 ",
"refId": "Voltage",
"select": [
[
{
"params": ["value"],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"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": 6,
"x": 12,
"y": 18
},
"id": 34,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": ["mean"],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "time_series",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT $__timeGroupAlias(date,$__interval), avg(case when charger_phases >= 1 then (case when charger_phases = 2 then 3 when charger_phases = 1 then 1 else 0 end) * charger_actual_current * charger_voltage / 1000.0 else charger_power end) as \"Power\" FROM charges WHERE charging_process_id = $charging_processes AND $__timeFilter(date) GROUP BY 1 ORDER BY 1 ",
"refId": "Current",
"select": [
[
{
"params": ["value"],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "celsius"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 6,
"x": 18,
"y": 18
},
"id": 24,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": ["mean"],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"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 ",
"refId": "Outdoor",
"select": [
[
{
"params": ["value"],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"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 ",
"refId": "Inside",
"select": [
[
{
"params": ["value"],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"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 ",
"refId": "Driver",
"select": [
[
{
"params": ["start_km"],
"type": "column"
}
]
],
"table": "drives",
"timeColumn": "start_date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
}
],
"refresh": false,
"schemaVersion": 38,
"style": "dark",
"tags": ["TeslamateCustomDashboards"],
"templating": {
"list": [
{
"current": {},
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"hide": 0,
"includeAll": false,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {},
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"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"
},
{
"current": {},
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"definition": "select unit_of_temperature from settings limit 1;",
"hide": 2,
"includeAll": false,
"multi": false,
"name": "temp_unit",
"options": [],
"query": "select unit_of_temperature from settings limit 1;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {},
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"definition": "--- Extracted from Battery Health Dashboard",
"hide": 2,
"includeAll": false,
"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,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {},
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"definition": "SELECT (round(extract(epoch FROM start_date) - 10) * 1000) AS start_date_ts FROM charging_processes WHERE id = $charging_processes",
"hide": 2,
"includeAll": false,
"multi": false,
"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,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {},
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"definition": "SELECT id FROM charging_processes WHERE car_id = $car_id ORDER BY start_date DESC LIMIT 1",
"hide": 2,
"includeAll": false,
"multi": false,
"name": "charging_processes",
"options": [],
"query": "SELECT id FROM charging_processes WHERE car_id = $car_id ORDER BY start_date DESC LIMIT 1",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {},
"datasource": {
"type": "postgres",
"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",
"hide": 2,
"includeAll": false,
"multi": false,
"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": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-15m",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Current Charge View",
"uid": "jchm9RxutVS7a",
"version": 7,
"weekStart": ""
}