1487 lines
55 KiB
JSON
1487 lines
55 KiB
JSON
{
|
|
"__elements": [],
|
|
"__requires": [
|
|
{
|
|
"type": "grafana",
|
|
"id": "grafana",
|
|
"name": "Grafana",
|
|
"version": "8.5.15"
|
|
},
|
|
{
|
|
"type": "datasource",
|
|
"id": "postgres",
|
|
"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 --",
|
|
"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,
|
|
"iteration": 1686816148286,
|
|
"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": ""
|
|
}
|
|
],
|
|
"liveNow": false,
|
|
"panels": [
|
|
{
|
|
"datasource": {
|
|
"type": "postgres",
|
|
"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",
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {
|
|
"mode": "thresholds"
|
|
},
|
|
"custom": {
|
|
"align": "center",
|
|
"displayMode": "auto",
|
|
"filterable": false,
|
|
"inspect": false,
|
|
"minWidth": 150
|
|
},
|
|
"decimals": 2,
|
|
"displayName": "",
|
|
"mappings": [],
|
|
"thresholds": {
|
|
"mode": "absolute",
|
|
"steps": [
|
|
{
|
|
"color": "green",
|
|
"value": null
|
|
},
|
|
{
|
|
"color": "red",
|
|
"value": 80
|
|
}
|
|
]
|
|
},
|
|
"unit": "short"
|
|
},
|
|
"overrides": [
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "start_date"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Date"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "dateTimeAsLocal"
|
|
},
|
|
{
|
|
"id": "links",
|
|
"value": [
|
|
{
|
|
"targetBlank": false,
|
|
"title": "View charge details",
|
|
"url": "d/BHhxFeZRz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 160
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "charge_energy_added"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Added"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "kwatth"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 80
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "start_battery_level"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "% Start"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "percent"
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 0
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 62
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "end_battery_level"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "% End"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "percent"
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 0
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 62
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "duration_min"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Duration"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "m"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 1
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 75
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "outside_temp_avg_c"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Temp"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "celsius"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 1
|
|
},
|
|
{
|
|
"id": "custom.displayMode",
|
|
"value": "color-text"
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "thresholds",
|
|
"value": {
|
|
"mode": "absolute",
|
|
"steps": [
|
|
{
|
|
"color": "#C0D8FF",
|
|
"value": null
|
|
},
|
|
{
|
|
"color": "#C8F2C2",
|
|
"value": 10
|
|
},
|
|
{
|
|
"color": "#FFA6B0",
|
|
"value": 20
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 70
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "cost"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Cost"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "none"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "links",
|
|
"value": [
|
|
{
|
|
"targetBlank": false,
|
|
"title": "Set Cost",
|
|
"url": "[[base_url:raw]]/charge-cost/${__data.fields.id.numeric}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "noValue",
|
|
"value": "-"
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 65
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byRegexp",
|
|
"options": "/.*_ts/"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "unit",
|
|
"value": "short"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.hidden",
|
|
"value": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "id"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "unit",
|
|
"value": "short"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.hidden",
|
|
"value": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "address"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Location"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "short"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "links",
|
|
"value": [
|
|
{
|
|
"targetBlank": true,
|
|
"title": "Create or edit geo-fence",
|
|
"url": "[[base_url:raw]]/geo-fences/${__data.fields.path}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 300
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "distance_km"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Driven"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "lengthkm"
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 0
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 90
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "charge_energy_added_per_hour"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "kW"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "kwatt"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 1
|
|
},
|
|
{
|
|
"id": "custom.displayMode",
|
|
"value": "color-text"
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "thresholds",
|
|
"value": {
|
|
"mode": "absolute",
|
|
"steps": [
|
|
{
|
|
"color": "#96D98D",
|
|
"value": null
|
|
},
|
|
{
|
|
"color": "#56A64B",
|
|
"value": 20
|
|
},
|
|
{
|
|
"color": "#37872D",
|
|
"value": 55
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 70
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "range_added_per_hour_km"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "km / h"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "lengthkm"
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 0
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 70
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "outside_temp_avg_f"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Temp"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "fahrenheit"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 1
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 70
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "distance_mi"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Driven"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "lengthmi"
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 0
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 90
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "range_added_per_hour_mi"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "mi / h"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "none"
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 70
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "path"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "unit",
|
|
"value": "short"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.hidden",
|
|
"value": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "charge_energy_used"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Used"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "kwatth"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 85
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "charging_efficiency"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Efficiency"
|
|
},
|
|
{
|
|
"id": "unit",
|
|
"value": "percentunit"
|
|
},
|
|
{
|
|
"id": "custom.align",
|
|
"value": "auto"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 0
|
|
},
|
|
{
|
|
"id": "custom.displayMode",
|
|
"value": "basic"
|
|
},
|
|
{
|
|
"id": "color",
|
|
"value": {
|
|
"mode": "continuous-RdYlGr"
|
|
}
|
|
},
|
|
{
|
|
"id": "max",
|
|
"value": 1
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 100
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "car_id"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "unit",
|
|
"value": "short"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.hidden",
|
|
"value": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "end_date"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "unit",
|
|
"value": "short"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "custom.align"
|
|
},
|
|
{
|
|
"id": "custom.hidden",
|
|
"value": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "cost_per_kwh"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "unit",
|
|
"value": "none"
|
|
},
|
|
{
|
|
"id": "displayName",
|
|
"value": "Cost/kWh"
|
|
},
|
|
{
|
|
"id": "decimals",
|
|
"value": 2
|
|
},
|
|
{
|
|
"id": "noValue",
|
|
"value": "-"
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 80
|
|
},
|
|
{
|
|
"id": "custom.align",
|
|
"value": "right"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byName",
|
|
"options": "charge_type"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Type"
|
|
},
|
|
{
|
|
"id": "custom.displayMode",
|
|
"value": "color-text"
|
|
},
|
|
{
|
|
"id": "custom.displayMode",
|
|
"value": "color-text"
|
|
},
|
|
{
|
|
"id": "color",
|
|
"value": {
|
|
"fixedColor": "super-light-blue",
|
|
"mode": "fixed"
|
|
}
|
|
},
|
|
{
|
|
"id": "custom.minWidth",
|
|
"value": 40
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"gridPos": {
|
|
"h": 21,
|
|
"w": 24,
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"id": 6,
|
|
"links": [],
|
|
"options": {
|
|
"footer": {
|
|
"fields": "",
|
|
"reducer": ["sum"],
|
|
"show": false
|
|
},
|
|
"showHeader": true,
|
|
"sortBy": []
|
|
},
|
|
"pluginVersion": "8.5.15",
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "postgres",
|
|
"uid": "TeslaMate"
|
|
},
|
|
"format": "table",
|
|
"group": [],
|
|
"metricColumn": "none",
|
|
"rawQuery": true,
|
|
"rawSql": "WITH data AS (\n SELECT\n (round(extract(epoch FROM start_date) - 10) * 1000) AS start_date_ts,\n (round(extract(epoch FROM end_date) + 10) * 1000) AS end_date_ts,\n start_date,\n end_date,\n CONCAT_WS(', ', COALESCE(addresses.name, nullif(CONCAT_WS(' ', addresses.road, addresses.house_number), '')), addresses.city) AS address,\n g.name as geofence_name,\n g.id as geofence_id,\n p.latitude,\n p.longitude,\n cp.charge_energy_added,\n cp.charge_energy_used,\n duration_min,\n start_battery_level,\n end_battery_level,\n start_[[preferred_range]]_range_km,\n end_[[preferred_range]]_range_km,\n outside_temp_avg,\n cp.id,\n lag(end_[[preferred_range]]_range_km) OVER (ORDER BY start_date) - start_[[preferred_range]]_range_km AS range_loss,\n p.odometer - lag(p.odometer) OVER (ORDER BY start_date) AS distance,\n cars.efficiency,\n cp.car_id,\n cost,\n max(c.charger_voltage) as max_charger_voltage,\n CASE WHEN NULLIF(mode() within group (order by charger_phases),0) is null THEN 'DC' ELSE 'AC' END AS charge_type\n FROM\n charging_processes cp\n\t LEFT JOIN charges c ON cp.id = c.charging_process_id\n LEFT JOIN positions p ON p.id = cp.position_id\n LEFT JOIN cars ON cars.id = cp.car_id\n LEFT JOIN addresses ON addresses.id = cp.address_id\n LEFT JOIN geofences g ON g.id = geofence_id\nWHERE \n cp.car_id = $car_id AND\n $__timeFilter(start_date) AND\n (cp.charge_energy_added IS NULL OR cp.charge_energy_added > 0) AND\n ('${geofence:pipe}' = '-1' OR geofence_id in ($geofence))\nGROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,21,p.odometer\nORDER BY\n start_date\n)\nSELECT\n start_date_ts,\n end_date_ts,\n CASE WHEN geofence_id IS NULL THEN CONCAT('new?lat=', latitude, '&lng=', longitude)\n WHEN geofence_id IS NOT NULL THEN CONCAT(geofence_id, '/edit')\n END as path,\n car_id,\n id,\n -- Columns\n start_date,\n end_date,\n COALESCE(geofence_name, address) as address, \n charge_type,\n duration_min,\n cost,\n cost / NULLIF(greatest(charge_energy_added, charge_energy_used), 0) as cost_per_kwh,\n charge_energy_added,\n charge_energy_used,\n CASE WHEN charge_energy_used IS NULL THEN NULL ELSE LEAST(charge_energy_added / NULLIF(charge_energy_used, 0), 1.0) END as charging_efficiency,\n convert_celsius(outside_temp_avg, '$temp_unit') AS outside_temp_avg_$temp_unit,\n charge_energy_added * 60 / NULLIF (duration_min, 0) AS charge_energy_added_per_hour,\n convert_km((end_[[preferred_range]]_range_km - start_[[preferred_range]]_range_km) * 60 / NULLIF (duration_min, 0), '$length_unit') AS range_added_per_hour_$length_unit,\n start_battery_level,\n end_battery_level,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit\n FROM\n data\nWHERE\n (distance >= 0 OR distance IS NULL)\n AND duration_min >= '$min_duration_min'\n AND CASE WHEN $cost = 0 THEN (cost IS NULL OR cost >= 0) ELSE cost >= $cost END\n AND charge_type = ANY(CASE WHEN array_to_string(ARRAY[$charge_type], ',') = 'DC' THEN ARRAY['DC'] WHEN array_to_string(ARRAY[$charge_type], ',') = 'AC' THEN ARRAY['AC'] ELSE ARRAY['DC', 'AC'] END)\n AND address ILIKE '%$location%'\nORDER BY\n start_date DESC;",
|
|
"refId": "A",
|
|
"select": [
|
|
[
|
|
{
|
|
"params": ["value"],
|
|
"type": "column"
|
|
}
|
|
]
|
|
],
|
|
"timeColumn": "time",
|
|
"where": [
|
|
{
|
|
"name": "$__timeFilter",
|
|
"params": [],
|
|
"type": "macro"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"title": "Charges: $charge_type",
|
|
"transformations": [],
|
|
"type": "table"
|
|
},
|
|
{
|
|
"datasource": {
|
|
"type": "datasource",
|
|
"uid": "-- Dashboard --"
|
|
},
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {
|
|
"mode": "thresholds"
|
|
},
|
|
"mappings": [
|
|
{
|
|
"options": {
|
|
"match": "null",
|
|
"result": {
|
|
"text": "N/A"
|
|
}
|
|
},
|
|
"type": "special"
|
|
}
|
|
],
|
|
"thresholds": {
|
|
"mode": "absolute",
|
|
"steps": [
|
|
{
|
|
"color": "green",
|
|
"value": null
|
|
},
|
|
{
|
|
"color": "red",
|
|
"value": 80
|
|
}
|
|
]
|
|
},
|
|
"unit": "kwatth"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {
|
|
"h": 4,
|
|
"w": 7,
|
|
"x": 0,
|
|
"y": 21
|
|
},
|
|
"id": 10,
|
|
"links": [],
|
|
"maxDataPoints": 100,
|
|
"options": {
|
|
"colorMode": "none",
|
|
"graphMode": "none",
|
|
"justifyMode": "auto",
|
|
"orientation": "horizontal",
|
|
"reduceOptions": {
|
|
"calcs": ["sum"],
|
|
"fields": "",
|
|
"values": false
|
|
},
|
|
"textMode": "auto"
|
|
},
|
|
"pluginVersion": "8.5.15",
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "datasource",
|
|
"uid": "-- Dashboard --"
|
|
},
|
|
"panelId": 6,
|
|
"refId": "A"
|
|
}
|
|
],
|
|
"title": "Energy added",
|
|
"transformations": [
|
|
{
|
|
"id": "filterFieldsByName",
|
|
"options": {
|
|
"include": {
|
|
"names": ["charge_energy_added"]
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"transparent": true,
|
|
"type": "stat"
|
|
},
|
|
{
|
|
"datasource": {
|
|
"type": "datasource",
|
|
"uid": "-- Dashboard --"
|
|
},
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {
|
|
"mode": "thresholds"
|
|
},
|
|
"mappings": [
|
|
{
|
|
"options": {
|
|
"match": "null",
|
|
"result": {
|
|
"text": "N/A"
|
|
}
|
|
},
|
|
"type": "special"
|
|
}
|
|
],
|
|
"thresholds": {
|
|
"mode": "absolute",
|
|
"steps": [
|
|
{
|
|
"color": "green",
|
|
"value": null
|
|
},
|
|
{
|
|
"color": "red",
|
|
"value": 80
|
|
}
|
|
]
|
|
},
|
|
"unit": "kwatth"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {
|
|
"h": 4,
|
|
"w": 7,
|
|
"x": 7,
|
|
"y": 21
|
|
},
|
|
"id": 12,
|
|
"links": [],
|
|
"maxDataPoints": 100,
|
|
"options": {
|
|
"colorMode": "none",
|
|
"graphMode": "none",
|
|
"justifyMode": "auto",
|
|
"orientation": "horizontal",
|
|
"reduceOptions": {
|
|
"calcs": ["sum"],
|
|
"fields": "",
|
|
"values": false
|
|
},
|
|
"textMode": "auto"
|
|
},
|
|
"pluginVersion": "8.5.15",
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "datasource",
|
|
"uid": "-- Dashboard --"
|
|
},
|
|
"panelId": 6,
|
|
"refId": "A"
|
|
}
|
|
],
|
|
"title": "Energy used",
|
|
"transformations": [
|
|
{
|
|
"id": "filterFieldsByName",
|
|
"options": {
|
|
"include": {
|
|
"names": ["charge_energy_used"]
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"transparent": true,
|
|
"type": "stat"
|
|
},
|
|
{
|
|
"datasource": {
|
|
"type": "datasource",
|
|
"uid": "-- Dashboard --"
|
|
},
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {
|
|
"mode": "thresholds"
|
|
},
|
|
"decimals": 2,
|
|
"mappings": [
|
|
{
|
|
"options": {
|
|
"match": "null",
|
|
"result": {
|
|
"text": "N/A"
|
|
}
|
|
},
|
|
"type": "special"
|
|
}
|
|
],
|
|
"thresholds": {
|
|
"mode": "absolute",
|
|
"steps": [
|
|
{
|
|
"color": "green",
|
|
"value": null
|
|
},
|
|
{
|
|
"color": "red",
|
|
"value": 80
|
|
}
|
|
]
|
|
},
|
|
"unit": "none"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {
|
|
"h": 4,
|
|
"w": 5,
|
|
"x": 14,
|
|
"y": 21
|
|
},
|
|
"id": 14,
|
|
"links": [],
|
|
"maxDataPoints": 100,
|
|
"options": {
|
|
"colorMode": "none",
|
|
"graphMode": "none",
|
|
"justifyMode": "auto",
|
|
"orientation": "horizontal",
|
|
"reduceOptions": {
|
|
"calcs": ["sum"],
|
|
"fields": "",
|
|
"values": false
|
|
},
|
|
"textMode": "auto"
|
|
},
|
|
"pluginVersion": "8.5.15",
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "datasource",
|
|
"uid": "-- Dashboard --"
|
|
},
|
|
"panelId": 6,
|
|
"refId": "A"
|
|
}
|
|
],
|
|
"title": "Cost",
|
|
"transformations": [
|
|
{
|
|
"id": "filterFieldsByName",
|
|
"options": {
|
|
"include": {
|
|
"names": ["cost"]
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"transparent": true,
|
|
"type": "stat"
|
|
},
|
|
{
|
|
"datasource": {
|
|
"type": "datasource",
|
|
"uid": "-- Dashboard --"
|
|
},
|
|
"description": "",
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {
|
|
"mode": "thresholds"
|
|
},
|
|
"decimals": 0,
|
|
"mappings": [
|
|
{
|
|
"options": {
|
|
"match": "null",
|
|
"result": {
|
|
"text": "N/A"
|
|
}
|
|
},
|
|
"type": "special"
|
|
}
|
|
],
|
|
"thresholds": {
|
|
"mode": "absolute",
|
|
"steps": [
|
|
{
|
|
"color": "green",
|
|
"value": null
|
|
},
|
|
{
|
|
"color": "red",
|
|
"value": 80
|
|
}
|
|
]
|
|
},
|
|
"unit": "m"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {
|
|
"h": 4,
|
|
"w": 5,
|
|
"x": 19,
|
|
"y": 21
|
|
},
|
|
"id": 15,
|
|
"links": [],
|
|
"maxDataPoints": 100,
|
|
"options": {
|
|
"colorMode": "none",
|
|
"graphMode": "none",
|
|
"justifyMode": "auto",
|
|
"orientation": "horizontal",
|
|
"reduceOptions": {
|
|
"calcs": ["mean"],
|
|
"fields": "",
|
|
"values": false
|
|
},
|
|
"textMode": "auto"
|
|
},
|
|
"pluginVersion": "8.5.15",
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "datasource",
|
|
"uid": "-- Dashboard --"
|
|
},
|
|
"panelId": 6,
|
|
"refId": "A"
|
|
}
|
|
],
|
|
"title": "Average Duration",
|
|
"transformations": [
|
|
{
|
|
"id": "filterFieldsByName",
|
|
"options": {
|
|
"include": {
|
|
"names": ["duration_min"]
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"transparent": true,
|
|
"type": "stat"
|
|
}
|
|
],
|
|
"refresh": "",
|
|
"schemaVersion": 36,
|
|
"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,
|
|
"tagValuesQuery": "",
|
|
"tagsQuery": "",
|
|
"type": "query",
|
|
"useTags": false
|
|
},
|
|
{
|
|
"current": {},
|
|
"datasource": {
|
|
"type": "postgres",
|
|
"uid": "TeslaMate"
|
|
},
|
|
"definition": "select unit_of_length from settings limit 1;",
|
|
"hide": 2,
|
|
"includeAll": false,
|
|
"label": "",
|
|
"multi": false,
|
|
"name": "length_unit",
|
|
"options": [],
|
|
"query": "select unit_of_length from settings limit 1;",
|
|
"refresh": 1,
|
|
"regex": "",
|
|
"skipUrlSync": false,
|
|
"sort": 0,
|
|
"tagValuesQuery": "",
|
|
"tagsQuery": "",
|
|
"type": "query",
|
|
"useTags": false
|
|
},
|
|
{
|
|
"current": {},
|
|
"datasource": {
|
|
"type": "postgres",
|
|
"uid": "TeslaMate"
|
|
},
|
|
"definition": "select unit_of_temperature from settings limit 1;",
|
|
"hide": 2,
|
|
"includeAll": false,
|
|
"label": "",
|
|
"multi": false,
|
|
"name": "temp_unit",
|
|
"options": [],
|
|
"query": "select unit_of_temperature from settings limit 1;",
|
|
"refresh": 1,
|
|
"regex": "",
|
|
"skipUrlSync": false,
|
|
"sort": 0,
|
|
"tagValuesQuery": "",
|
|
"tagsQuery": "",
|
|
"type": "query",
|
|
"useTags": false
|
|
},
|
|
{
|
|
"current": {},
|
|
"datasource": {
|
|
"type": "postgres",
|
|
"uid": "TeslaMate"
|
|
},
|
|
"definition": "select preferred_range from settings limit 1;",
|
|
"hide": 2,
|
|
"includeAll": false,
|
|
"multi": false,
|
|
"name": "preferred_range",
|
|
"options": [],
|
|
"query": "select preferred_range from settings limit 1;",
|
|
"refresh": 1,
|
|
"regex": "",
|
|
"skipUrlSync": false,
|
|
"sort": 0,
|
|
"tagValuesQuery": "",
|
|
"tagsQuery": "",
|
|
"type": "query",
|
|
"useTags": false
|
|
},
|
|
{
|
|
"current": {},
|
|
"datasource": {
|
|
"type": "postgres",
|
|
"uid": "TeslaMate"
|
|
},
|
|
"definition": "select base_url from settings limit 1;",
|
|
"hide": 2,
|
|
"includeAll": false,
|
|
"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
|
|
},
|
|
{
|
|
"allValue": "-1",
|
|
"current": {},
|
|
"datasource": {
|
|
"type": "postgres",
|
|
"uid": "TeslaMate"
|
|
},
|
|
"definition": "SELECT name AS __text, id AS __value FROM geofences ORDER BY name COLLATE \"C\" ASC;",
|
|
"hide": 0,
|
|
"includeAll": true,
|
|
"label": "Geofence",
|
|
"multi": true,
|
|
"name": "geofence",
|
|
"options": [],
|
|
"query": "SELECT name AS __text, id AS __value FROM geofences ORDER BY name COLLATE \"C\" ASC;",
|
|
"refresh": 1,
|
|
"regex": "",
|
|
"skipUrlSync": false,
|
|
"sort": 0,
|
|
"tagValuesQuery": "",
|
|
"tagsQuery": "",
|
|
"type": "query",
|
|
"useTags": false
|
|
},
|
|
{
|
|
"current": {
|
|
"selected": false,
|
|
"text": "",
|
|
"value": ""
|
|
},
|
|
"description": "Type a text contained in Location",
|
|
"hide": 0,
|
|
"label": "Location",
|
|
"name": "location",
|
|
"options": [
|
|
{
|
|
"selected": true,
|
|
"text": "",
|
|
"value": ""
|
|
}
|
|
],
|
|
"query": "",
|
|
"skipUrlSync": false,
|
|
"type": "textbox"
|
|
},
|
|
{
|
|
"allValue": "",
|
|
"current": {
|
|
"selected": true,
|
|
"text": ["All"],
|
|
"value": ["$__all"]
|
|
},
|
|
"hide": 0,
|
|
"includeAll": true,
|
|
"label": "Type",
|
|
"multi": true,
|
|
"name": "charge_type",
|
|
"options": [
|
|
{
|
|
"selected": true,
|
|
"text": "All",
|
|
"value": "$__all"
|
|
},
|
|
{
|
|
"selected": false,
|
|
"text": "AC",
|
|
"value": "AC"
|
|
},
|
|
{
|
|
"selected": false,
|
|
"text": "DC",
|
|
"value": "DC"
|
|
}
|
|
],
|
|
"query": "AC, DC",
|
|
"queryValue": "",
|
|
"skipUrlSync": false,
|
|
"type": "custom"
|
|
},
|
|
{
|
|
"current": {
|
|
"selected": false,
|
|
"text": "0",
|
|
"value": "0"
|
|
},
|
|
"hide": 0,
|
|
"label": "Cost >=",
|
|
"name": "cost",
|
|
"options": [
|
|
{
|
|
"selected": true,
|
|
"text": "0",
|
|
"value": "0"
|
|
}
|
|
],
|
|
"query": "0",
|
|
"skipUrlSync": false,
|
|
"type": "textbox"
|
|
},
|
|
{
|
|
"current": {
|
|
"selected": true,
|
|
"text": "0",
|
|
"value": "0"
|
|
},
|
|
"hide": 0,
|
|
"label": "Duration (minutes) >=",
|
|
"name": "min_duration_min",
|
|
"options": [
|
|
{
|
|
"selected": true,
|
|
"text": "0",
|
|
"value": "0"
|
|
}
|
|
],
|
|
"query": "0",
|
|
"skipUrlSync": false,
|
|
"type": "textbox"
|
|
}
|
|
]
|
|
},
|
|
"time": {
|
|
"from": "now-1M",
|
|
"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"
|
|
]
|
|
},
|
|
"timezone": "",
|
|
"title": "Browse Charges",
|
|
"uid": "jchmTSmNYvRRk",
|
|
"version": 4,
|
|
"weekStart": ""
|
|
}
|