1842 lines
68 KiB
JSON
1842 lines
68 KiB
JSON
|
{
|
||
|
"__elements": {},
|
||
|
"__requires": [
|
||
|
{
|
||
|
"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": "panel",
|
||
|
"id": "piechart",
|
||
|
"name": "Pie chart",
|
||
|
"version": ""
|
||
|
},
|
||
|
{
|
||
|
"type": "datasource",
|
||
|
"id": "postgres",
|
||
|
"name": "PostgreSQL",
|
||
|
"version": "1.0.0"
|
||
|
},
|
||
|
{
|
||
|
"type": "panel",
|
||
|
"id": "stat",
|
||
|
"name": "Stat",
|
||
|
"version": ""
|
||
|
},
|
||
|
{
|
||
|
"type": "panel",
|
||
|
"id": "state-timeline",
|
||
|
"name": "State timeline",
|
||
|
"version": ""
|
||
|
}
|
||
|
],
|
||
|
"annotations": {
|
||
|
"list": [
|
||
|
{
|
||
|
"$$hashKey": "object:427",
|
||
|
"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": [
|
||
|
{
|
||
|
"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": "Only distinguishes between online, offline and asleep.",
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"mappings": [],
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "#c7d0d9",
|
||
|
"value": null
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"unit": "none"
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 3,
|
||
|
"w": 4,
|
||
|
"x": 0,
|
||
|
"y": 0
|
||
|
},
|
||
|
"id": 6,
|
||
|
"links": [],
|
||
|
"maxDataPoints": 100,
|
||
|
"options": {
|
||
|
"colorMode": "value",
|
||
|
"fieldOptions": {
|
||
|
"calcs": ["first"]
|
||
|
},
|
||
|
"graphMode": "none",
|
||
|
"justifyMode": "auto",
|
||
|
"orientation": "horizontal",
|
||
|
"reduceOptions": {
|
||
|
"calcs": ["mean"],
|
||
|
"fields": "/^state$/",
|
||
|
"values": true
|
||
|
},
|
||
|
"textMode": "value"
|
||
|
},
|
||
|
"pluginVersion": "10.1.2",
|
||
|
"targets": [
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"format": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "select $__time(start_date), state from states where car_id = $car_id AND $__timeFilter(start_date) order by start_date desc limit 1;",
|
||
|
"refId": "A",
|
||
|
"select": [
|
||
|
[
|
||
|
{
|
||
|
"params": ["latitude"],
|
||
|
"type": "column"
|
||
|
}
|
||
|
]
|
||
|
],
|
||
|
"table": "addresses",
|
||
|
"timeColumn": "inserted_at",
|
||
|
"timeColumnType": "timestamp",
|
||
|
"where": [
|
||
|
{
|
||
|
"name": "$__timeFilter",
|
||
|
"params": [],
|
||
|
"type": "macro"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"title": "Current State",
|
||
|
"type": "stat"
|
||
|
},
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"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.",
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"mappings": [],
|
||
|
"noValue": "-",
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "#c7d0d9",
|
||
|
"value": null
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"unit": "dateTimeAsSystem"
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 3,
|
||
|
"w": 8,
|
||
|
"x": 4,
|
||
|
"y": 0
|
||
|
},
|
||
|
"id": 2,
|
||
|
"links": [],
|
||
|
"maxDataPoints": 100,
|
||
|
"options": {
|
||
|
"colorMode": "value",
|
||
|
"fieldOptions": {
|
||
|
"calcs": ["mean"]
|
||
|
},
|
||
|
"graphMode": "none",
|
||
|
"justifyMode": "auto",
|
||
|
"orientation": "horizontal",
|
||
|
"reduceOptions": {
|
||
|
"calcs": ["mean"],
|
||
|
"fields": "/^time$/",
|
||
|
"values": true
|
||
|
},
|
||
|
"textMode": "value"
|
||
|
},
|
||
|
"pluginVersion": "10.1.2",
|
||
|
"targets": [
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"format": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "select $__time(start_date), state from states where car_id = $car_id AND $__timeFilter(start_date) order by start_date desc limit 1;",
|
||
|
"refId": "A",
|
||
|
"select": [
|
||
|
[
|
||
|
{
|
||
|
"params": ["latitude"],
|
||
|
"type": "column"
|
||
|
}
|
||
|
]
|
||
|
],
|
||
|
"table": "addresses",
|
||
|
"timeColumn": "inserted_at",
|
||
|
"timeColumnType": "timestamp",
|
||
|
"where": [
|
||
|
{
|
||
|
"name": "$__timeFilter",
|
||
|
"params": [],
|
||
|
"type": "macro"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"title": "Last state change",
|
||
|
"type": "stat"
|
||
|
},
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"description": "",
|
||
|
"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": 3,
|
||
|
"x": 12,
|
||
|
"y": 0
|
||
|
},
|
||
|
"id": 69,
|
||
|
"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 AND $__timeFilter(date)\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 AND $__timeFilter(date)\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": "$preferred_range range",
|
||
|
"type": "stat"
|
||
|
},
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"description": "",
|
||
|
"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": 3,
|
||
|
"x": 15,
|
||
|
"y": 0
|
||
|
},
|
||
|
"id": 70,
|
||
|
"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": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "SELECT $__time(date), range as \"range_$length_unit\"\nFROM (\n\t(SELECT date, convert_km(est_battery_range_km, '$length_unit') AS range\n\tFROM positions\n\tWHERE car_id = $car_id AND est_battery_range_km IS NOT NULL AND $__timeFilter(date)\n ORDER BY date DESC\n\tLIMIT 1)\n\tUNION ALL\n\t(SELECT date, convert_km(ideal_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 AND $__timeFilter(date)\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": "estimated range",
|
||
|
"type": "stat"
|
||
|
},
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"color": {
|
||
|
"mode": "thresholds"
|
||
|
},
|
||
|
"displayName": "",
|
||
|
"mappings": [],
|
||
|
"max": 100,
|
||
|
"min": 0,
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "light-red",
|
||
|
"value": null
|
||
|
},
|
||
|
{
|
||
|
"color": "semi-dark-yellow",
|
||
|
"value": 10
|
||
|
},
|
||
|
{
|
||
|
"color": "semi-dark-green",
|
||
|
"value": 20
|
||
|
},
|
||
|
{
|
||
|
"color": "semi-dark-yellow",
|
||
|
"value": 81
|
||
|
},
|
||
|
{
|
||
|
"color": "light-red",
|
||
|
"value": 91
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"unit": "percent"
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 4,
|
||
|
"w": 3,
|
||
|
"x": 18,
|
||
|
"y": 0
|
||
|
},
|
||
|
"id": 85,
|
||
|
"options": {
|
||
|
"orientation": "auto",
|
||
|
"reduceOptions": {
|
||
|
"calcs": ["mean"],
|
||
|
"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 battery_level, date FROM positions WHERE car_id = $car_id AND $__timeFilter(date) ORDER BY date DESC LIMIT 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": "A",
|
||
|
"select": [
|
||
|
[
|
||
|
{
|
||
|
"params": ["battery_level"],
|
||
|
"type": "column"
|
||
|
}
|
||
|
]
|
||
|
],
|
||
|
"table": "positions",
|
||
|
"timeColumn": "date",
|
||
|
"timeColumnType": "timestamp",
|
||
|
"where": []
|
||
|
}
|
||
|
],
|
||
|
"title": "Battery Level",
|
||
|
"type": "gauge"
|
||
|
},
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"description": "",
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"decimals": 2,
|
||
|
"mappings": [],
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "#c7d0d9",
|
||
|
"value": null
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"unit": "none"
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 8,
|
||
|
"w": 3,
|
||
|
"x": 21,
|
||
|
"y": 0
|
||
|
},
|
||
|
"id": 71,
|
||
|
"links": [],
|
||
|
"maxDataPoints": 100,
|
||
|
"options": {
|
||
|
"colorMode": "value",
|
||
|
"fieldOptions": {
|
||
|
"calcs": ["first"]
|
||
|
},
|
||
|
"graphMode": "none",
|
||
|
"justifyMode": "auto",
|
||
|
"orientation": "horizontal",
|
||
|
"reduceOptions": {
|
||
|
"calcs": ["mean"],
|
||
|
"fields": "",
|
||
|
"values": true
|
||
|
},
|
||
|
"textMode": "value_and_name"
|
||
|
},
|
||
|
"pluginVersion": "10.1.2",
|
||
|
"targets": [
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"format": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "SELECT\r\n convert_tire_pressure(tpms_pressure_fl,'$pressure_unit') AS \"Front left\",\r\n convert_tire_pressure(tpms_pressure_fr,'$pressure_unit') AS \"Front right\",\r\n convert_tire_pressure(tpms_pressure_rl,'$pressure_unit') AS \"Rear left\",\r\n convert_tire_pressure(tpms_pressure_rr,'$pressure_unit') AS \"Rear right\"\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 DESC LIMIT 1",
|
||
|
"refId": "A",
|
||
|
"select": [
|
||
|
[
|
||
|
{
|
||
|
"params": ["latitude"],
|
||
|
"type": "column"
|
||
|
}
|
||
|
]
|
||
|
],
|
||
|
"table": "addresses",
|
||
|
"timeColumn": "inserted_at",
|
||
|
"timeColumnType": "timestamp",
|
||
|
"where": [
|
||
|
{
|
||
|
"name": "$__timeFilter",
|
||
|
"params": [],
|
||
|
"type": "macro"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"title": "Tire Pressure ($pressure_unit)",
|
||
|
"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": 12,
|
||
|
"x": 0,
|
||
|
"y": 3
|
||
|
},
|
||
|
"id": 86,
|
||
|
"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": 3,
|
||
|
"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": {
|
||
|
"mode": "thresholds"
|
||
|
},
|
||
|
"decimals": 0,
|
||
|
"mappings": [],
|
||
|
"max": 100,
|
||
|
"min": 0,
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "semi-dark-green",
|
||
|
"value": null
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"unit": "degree"
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 4,
|
||
|
"w": 3,
|
||
|
"x": 12,
|
||
|
"y": 4
|
||
|
},
|
||
|
"id": 59,
|
||
|
"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": {
|
||
|
"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": 4,
|
||
|
"w": 3,
|
||
|
"x": 15,
|
||
|
"y": 4
|
||
|
},
|
||
|
"id": 63,
|
||
|
"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": 4,
|
||
|
"w": 3,
|
||
|
"x": 18,
|
||
|
"y": 4
|
||
|
},
|
||
|
"id": 61,
|
||
|
"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": {
|
||
|
"fixedColor": "super-light-blue",
|
||
|
"mode": "fixed"
|
||
|
},
|
||
|
"mappings": [],
|
||
|
"noValue": "-",
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "super-light-blue",
|
||
|
"value": null
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 3,
|
||
|
"w": 3,
|
||
|
"x": 12,
|
||
|
"y": 8
|
||
|
},
|
||
|
"id": 79,
|
||
|
"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\n COALESCE(g.name, CONCAT_WS(', ', COALESCE(addresses.name, CONCAT_WS(' ', addresses.road, addresses.house_number)), addresses.city))\n\tFROM drives d\n\tLEFT JOIN addresses ON addresses.id = d.end_address_id\n\tLEFT JOIN geofences g ON g.id = d.end_geofence_id\nWHERE\n\t $__timeFilter(d.end_date) AND d.car_id = $car_id \nORDER BY d.end_date DESC\nLIMIT 1",
|
||
|
"refId": "Voltage",
|
||
|
"select": [
|
||
|
[
|
||
|
{
|
||
|
"params": ["value"],
|
||
|
"type": "column"
|
||
|
}
|
||
|
]
|
||
|
],
|
||
|
"timeColumn": "time",
|
||
|
"where": [
|
||
|
{
|
||
|
"name": "$__timeFilter",
|
||
|
"params": [],
|
||
|
"type": "macro"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"title": "Location",
|
||
|
"type": "stat"
|
||
|
},
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"color": {
|
||
|
"mode": "palette-classic"
|
||
|
},
|
||
|
"custom": {
|
||
|
"hideFrom": {
|
||
|
"legend": false,
|
||
|
"tooltip": false,
|
||
|
"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"
|
||
|
}
|
||
|
],
|
||
|
"noValue": "0",
|
||
|
"unit": "dtdhms"
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 9,
|
||
|
"w": 9,
|
||
|
"x": 15,
|
||
|
"y": 8
|
||
|
},
|
||
|
"id": 41,
|
||
|
"options": {
|
||
|
"displayLabels": ["percent", "name"],
|
||
|
"legend": {
|
||
|
"displayMode": "table",
|
||
|
"placement": "right",
|
||
|
"showLegend": true,
|
||
|
"values": ["value", "percent"]
|
||
|
},
|
||
|
"pieType": "pie",
|
||
|
"reduceOptions": {
|
||
|
"calcs": ["lastNotNull"],
|
||
|
"fields": "/^total_time$/",
|
||
|
"values": true
|
||
|
},
|
||
|
"tooltip": {
|
||
|
"mode": "single",
|
||
|
"sort": "none"
|
||
|
}
|
||
|
},
|
||
|
"pluginVersion": "8.5.15",
|
||
|
"targets": [
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"format": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "WITH states AS (\r\n SELECT\r\n unnest(ARRAY [start_date + interval '1 second', end_date]) AS date,\r\n unnest(ARRAY [2, 0]) AS state\r\n FROM charging_processes\r\n WHERE\r\n car_id = $car_id AND \r\n ($__timeFrom() :: timestamp - interval '30 day') < start_date AND \r\n (end_date < ($__timeTo() :: timestamp + interval '30 day') OR end_date IS NULL)\r\n UNION\r\n SELECT\r\n unnest(ARRAY [start_date + interval '1 second', end_date]) AS date,\r\n unnest(ARRAY [1, 0]) AS state\r\n FROM drives\r\n WHERE\r\n car_id = $car_id AND \r\n ($__timeFrom() :: timestamp - interval '30 day') < start_date AND \r\n (end_date < ($__timeTo() :: timestamp + interval '30 day') OR end_date IS NULL)\r\n UNION\r\n SELECT\r\n start_date AS date,\r\n CASE\r\n WHEN state = 'offline' THEN 3\r\n WHEN state = 'asleep' THEN 4\r\n WHEN state = 'online' THEN 5\r\n END AS state\r\n FROM states\r\n WHERE\r\n car_id = $car_id AND \r\n ($__timeFrom() :: timestamp - interval '30 day') < start_date AND \r\n (end_date < ($__timeTo() :: timestamp + interval '30 day') OR end_date IS NULL)\r\n UNION\r\n SELECT\r\n unnest(ARRAY [start_date + interval '1 second', end_date]) AS date,\r\n unnest(ARRAY [6, 0]) AS state\r\n FROM updates\r\n WHERE\r\n car_id = $car_id AND \r\n ($__timeFrom() :: timestamp - interval '30 day') < start_date AND \r\n (end_date < ($__timeTo() :: timestamp + interval '30 day') OR end_date IS NULL)\r\n), aux AS (\r\n SELECT $__timeFrom() :: timestamp AS date, (SELECT state FROM states WHERE date <= $__timeFrom() ORDER BY date DESC LIMIT 1) AS state, false AS include\r\n UNION\r\n SELECT date, state, true AS include FROM states\r\n UNION\r\n SELECT $__timeTo() :: timestamp as date, NULL AS state, true as include\r\n ORDER BY date\r\n), states_elapsed AS (\r\n SELECT \r\n date, state AS current_state, include,\r\n LAG(state) OVER (ORDER BY date) AS state,\r\n LAG(date) OVER (ORDER BY date) AS last_state_time,\r\n date - LAG(date) OVER (ORDER BY date) AS elapsed_time\r\n FROM aux \r\n)\r\nSELECT \r\n CASE\r\n WHEN state = 0 OR state = 5 THEN 'online'\r\n WHEN state = 1 THEN 'driving'\r\n WHEN state = 2 THEN 'charging'\r\n WHEN state = 3 THEN 'offline'\r\n WHEN state = 4 THEN 'asleep'\r\n WHEN state = 6 THEN 'updating'\r\n END AS state,\r\n EXTRACT(EPOCH FROM SUM(elapsed_time)) as Total_Time\r\nFROM states_elapsed\r\nWHERE $__timeFilter(date) AND include\r\nGROUP BY 1\r\n\r\n",
|
||
|
"refId": "A",
|
||
|
"select": [
|
||
|
[
|
||
|
{
|
||
|
"params": ["efficiency"],
|
||
|
"type": "column"
|
||
|
}
|
||
|
]
|
||
|
],
|
||
|
"table": "cars",
|
||
|
"timeColumn": "inserted_at",
|
||
|
"timeColumnType": "timestamp",
|
||
|
"where": [
|
||
|
{
|
||
|
"name": "$__timeFilter",
|
||
|
"params": [],
|
||
|
"type": "macro"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"title": "States",
|
||
|
"type": "piechart"
|
||
|
},
|
||
|
{
|
||
|
"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": 3,
|
||
|
"x": 12,
|
||
|
"y": 11
|
||
|
},
|
||
|
"id": 55,
|
||
|
"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": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "select convert_km(odometer::numeric, '$length_unit') as \"odometer_$length_unit\"\nfrom positions \nwhere car_id = $car_id AND $__timeFilter(date)\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",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"mappings": [],
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "#c7d0d9",
|
||
|
"value": null
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"unit": "none"
|
||
|
},
|
||
|
"overrides": [
|
||
|
{
|
||
|
"matcher": {
|
||
|
"id": "byName",
|
||
|
"options": "version"
|
||
|
},
|
||
|
"properties": [
|
||
|
{
|
||
|
"id": "unit",
|
||
|
"value": "string"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 3,
|
||
|
"w": 3,
|
||
|
"x": 12,
|
||
|
"y": 14
|
||
|
},
|
||
|
"id": 57,
|
||
|
"links": [
|
||
|
{
|
||
|
"targetBlank": true,
|
||
|
"title": "Updates",
|
||
|
"url": "/d/IiC07mgWz/updates?"
|
||
|
}
|
||
|
],
|
||
|
"maxDataPoints": 100,
|
||
|
"options": {
|
||
|
"colorMode": "value",
|
||
|
"fieldOptions": {
|
||
|
"calcs": ["first"]
|
||
|
},
|
||
|
"graphMode": "none",
|
||
|
"justifyMode": "auto",
|
||
|
"orientation": "horizontal",
|
||
|
"reduceOptions": {
|
||
|
"calcs": ["mean"],
|
||
|
"fields": "/^version$/",
|
||
|
"values": true
|
||
|
},
|
||
|
"textMode": "value"
|
||
|
},
|
||
|
"pluginVersion": "10.1.2",
|
||
|
"targets": [
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"format": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "select split_part(version, ' ', 1) as version \nfrom updates \nwhere car_id = $car_id AND start_date <= $__timeTo()\norder by start_date desc \nlimit 1",
|
||
|
"refId": "A",
|
||
|
"select": [
|
||
|
[
|
||
|
{
|
||
|
"params": ["efficiency"],
|
||
|
"type": "column"
|
||
|
}
|
||
|
]
|
||
|
],
|
||
|
"table": "cars",
|
||
|
"timeColumn": "inserted_at",
|
||
|
"timeColumnType": "timestamp",
|
||
|
"where": [
|
||
|
{
|
||
|
"name": "$__timeFilter",
|
||
|
"params": [],
|
||
|
"type": "macro"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"title": "Firmware",
|
||
|
"type": "stat"
|
||
|
},
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"color": {
|
||
|
"mode": "continuous-GrYlRd"
|
||
|
},
|
||
|
"custom": {
|
||
|
"fillOpacity": 100,
|
||
|
"hideFrom": {
|
||
|
"legend": false,
|
||
|
"tooltip": false,
|
||
|
"viz": false
|
||
|
},
|
||
|
"insertNulls": false,
|
||
|
"lineWidth": 0,
|
||
|
"spanNulls": false
|
||
|
},
|
||
|
"mappings": [
|
||
|
{
|
||
|
"options": {
|
||
|
"0": {
|
||
|
"color": "#6ED0E0",
|
||
|
"index": 0,
|
||
|
"text": "online"
|
||
|
},
|
||
|
"1": {
|
||
|
"color": "#8F3BB8",
|
||
|
"index": 1,
|
||
|
"text": "driving"
|
||
|
},
|
||
|
"2": {
|
||
|
"color": "#F2CC0C",
|
||
|
"index": 2,
|
||
|
"text": "charging"
|
||
|
},
|
||
|
"3": {
|
||
|
"color": "#FFB357",
|
||
|
"index": 3,
|
||
|
"text": "offline"
|
||
|
},
|
||
|
"4": {
|
||
|
"color": "#56A64B",
|
||
|
"index": 4,
|
||
|
"text": "asleep"
|
||
|
},
|
||
|
"5": {
|
||
|
"color": "#6ED0E0",
|
||
|
"index": 5,
|
||
|
"text": "online"
|
||
|
},
|
||
|
"6": {
|
||
|
"color": "#E02F44",
|
||
|
"index": 6,
|
||
|
"text": "updating"
|
||
|
},
|
||
|
"null": {
|
||
|
"index": 7,
|
||
|
"text": "N/A"
|
||
|
}
|
||
|
},
|
||
|
"type": "value"
|
||
|
}
|
||
|
],
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "green",
|
||
|
"value": null
|
||
|
},
|
||
|
{
|
||
|
"color": "red",
|
||
|
"value": 80
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 5,
|
||
|
"w": 24,
|
||
|
"x": 0,
|
||
|
"y": 17
|
||
|
},
|
||
|
"id": 83,
|
||
|
"links": [
|
||
|
{
|
||
|
"title": "States",
|
||
|
"url": "/d/xo4BNRkZz/states"
|
||
|
}
|
||
|
],
|
||
|
"options": {
|
||
|
"alignValue": "center",
|
||
|
"legend": {
|
||
|
"displayMode": "list",
|
||
|
"placement": "bottom",
|
||
|
"showLegend": false
|
||
|
},
|
||
|
"mergeValues": true,
|
||
|
"rowHeight": 0.9,
|
||
|
"showValue": "auto",
|
||
|
"tooltip": {
|
||
|
"mode": "single",
|
||
|
"sort": "none"
|
||
|
}
|
||
|
},
|
||
|
"targets": [
|
||
|
{
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"format": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "WITH states AS (\n SELECT\n unnest(ARRAY [start_date + interval '1 second', end_date]) AS date,\n unnest(ARRAY [2, 0]) AS state\n FROM charging_processes\n WHERE\n car_id = $car_id AND \n ($__timeFrom() :: timestamp - interval '30 day') < start_date AND \n (end_date < ($__timeTo() :: timestamp + interval '30 day') OR end_date IS NULL)\n UNION\n SELECT\n unnest(ARRAY [start_date + interval '1 second', end_date]) AS date,\n unnest(ARRAY [1, 0]) AS state\n FROM drives\n WHERE\n car_id = $car_id AND \n ($__timeFrom() :: timestamp - interval '30 day') < start_date AND \n (end_date < ($__timeTo() :: timestamp + interval '30 day') OR end_date IS NULL)\n UNION\n SELECT\n start_date AS date,\n CASE\n WHEN state = 'offline' THEN 3\n WHEN state = 'asleep' THEN 4\n WHEN state = 'online' THEN 5\n END AS state\n FROM states\n WHERE\n car_id = $car_id AND \n ($__timeFrom() :: timestamp - interval '30 day') < start_date AND \n (end_date < ($__timeTo() :: timestamp + interval '30 day') OR end_date IS NULL)\n UNION\n SELECT\n unnest(ARRAY [start_date + interval '1 second', end_date]) AS date,\n unnest(ARRAY [6, 0]) AS state\n FROM updates\n WHERE\n car_id = $car_id AND \n ($__timeFrom() :: timestamp - interval '30 day') < start_date AND \n (end_date < ($__timeTo() :: timestamp + interval '30 day') OR end_date IS NULL)\n)\nSELECT date AS \"time\", state\nFROM states\nWHERE \n date IS NOT NULL AND\n ($__timeFrom() :: timestamp - interval '30 day') < date AND \n date < ($__timeTo() :: timestamp + interval '30 day') \nORDER BY date ASC, state ASC;",
|
||
|
"refId": "A",
|
||
|
"select": [
|
||
|
[
|
||
|
{
|
||
|
"params": ["latitude"],
|
||
|
"type": "column"
|
||
|
}
|
||
|
]
|
||
|
],
|
||
|
"table": "geofences",
|
||
|
"timeColumn": "inserted_at",
|
||
|
"timeColumnType": "timestamp",
|
||
|
"where": [
|
||
|
{
|
||
|
"name": "$__timeFilter",
|
||
|
"params": [],
|
||
|
"type": "macro"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"title": "Timeline",
|
||
|
"type": "state-timeline"
|
||
|
}
|
||
|
],
|
||
|
"refresh": "30s",
|
||
|
"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,
|
||
|
"tagValuesQuery": "",
|
||
|
"tagsQuery": "",
|
||
|
"type": "query",
|
||
|
"useTags": false
|
||
|
},
|
||
|
{
|
||
|
"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",
|
||
|
"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": "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,
|
||
|
"type": "query"
|
||
|
},
|
||
|
{
|
||
|
"current": {},
|
||
|
"datasource": {
|
||
|
"type": "postgres",
|
||
|
"uid": "TeslaMate"
|
||
|
},
|
||
|
"definition": "select unit_of_pressure from settings limit 1;",
|
||
|
"hide": 2,
|
||
|
"includeAll": false,
|
||
|
"multi": false,
|
||
|
"name": "pressure_unit",
|
||
|
"options": [],
|
||
|
"query": "select unit_of_pressure from settings limit 1;",
|
||
|
"refresh": 1,
|
||
|
"regex": "",
|
||
|
"skipUrlSync": false,
|
||
|
"sort": 0,
|
||
|
"type": "query"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"time": {
|
||
|
"from": "now-24h",
|
||
|
"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": "Current State",
|
||
|
"uid": "jchmo4BNRkZz",
|
||
|
"version": 11,
|
||
|
"weekStart": ""
|
||
|
}
|