509 lines
18 KiB
JSON
509 lines
18 KiB
JSON
|
{
|
||
|
"annotations": {
|
||
|
"list": [
|
||
|
{
|
||
|
"$$hashKey": "object:427",
|
||
|
"builtIn": 1,
|
||
|
"datasource": "-- Grafana --",
|
||
|
"enable": true,
|
||
|
"hide": true,
|
||
|
"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,
|
||
|
"iteration": 1642780620514,
|
||
|
"links": [
|
||
|
{
|
||
|
"icon": "dashboard",
|
||
|
"tags": [],
|
||
|
"title": "TeslaMate",
|
||
|
"tooltip": "",
|
||
|
"type": "link",
|
||
|
"url": "[[base_url:raw]]"
|
||
|
},
|
||
|
{
|
||
|
"asDropdown": true,
|
||
|
"icon": "external link",
|
||
|
"tags": ["tesla"],
|
||
|
"title": "Dashboards",
|
||
|
"type": "dashboards"
|
||
|
}
|
||
|
],
|
||
|
"liveNow": false,
|
||
|
"panels": [
|
||
|
{
|
||
|
"datasource": "TeslaMate",
|
||
|
"gridPos": {
|
||
|
"h": 1,
|
||
|
"w": 24,
|
||
|
"x": 0,
|
||
|
"y": 0
|
||
|
},
|
||
|
"id": 16,
|
||
|
"panels": [],
|
||
|
"repeat": "car_id",
|
||
|
"title": "$car_id",
|
||
|
"type": "row"
|
||
|
},
|
||
|
{
|
||
|
"datasource": "TeslaMate",
|
||
|
"description": "Only distinguishes between online, offline and asleep.",
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"mappings": [],
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "#c7d0d9",
|
||
|
"value": null
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"unit": "dateTimeAsLocal"
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 3,
|
||
|
"w": 12,
|
||
|
"x": 0,
|
||
|
"y": 1
|
||
|
},
|
||
|
"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": "8.3.4",
|
||
|
"targets": [
|
||
|
{
|
||
|
"format": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "select $__time(start_date), state from states where car_id = $car_id 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": "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": 6,
|
||
|
"x": 12,
|
||
|
"y": 1
|
||
|
},
|
||
|
"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": "8.3.4",
|
||
|
"targets": [
|
||
|
{
|
||
|
"format": "table",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "select $__time(start_date), state from states where car_id = $car_id 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": "TeslaMate",
|
||
|
"description": "based on any data ever recorded.",
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"mappings": [
|
||
|
{
|
||
|
"options": {
|
||
|
"match": "null",
|
||
|
"result": {
|
||
|
"text": "N/A"
|
||
|
}
|
||
|
},
|
||
|
"type": "special"
|
||
|
}
|
||
|
],
|
||
|
"max": 1,
|
||
|
"min": 0,
|
||
|
"thresholds": {
|
||
|
"mode": "absolute",
|
||
|
"steps": [
|
||
|
{
|
||
|
"color": "#c7d0d9",
|
||
|
"value": null
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"unit": "percentunit"
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 3,
|
||
|
"w": 6,
|
||
|
"x": 18,
|
||
|
"y": 1
|
||
|
},
|
||
|
"id": 8,
|
||
|
"links": [],
|
||
|
"maxDataPoints": 100,
|
||
|
"options": {
|
||
|
"colorMode": "value",
|
||
|
"fieldOptions": {
|
||
|
"calcs": ["lastNotNull"]
|
||
|
},
|
||
|
"graphMode": "none",
|
||
|
"justifyMode": "auto",
|
||
|
"orientation": "horizontal",
|
||
|
"reduceOptions": {
|
||
|
"calcs": ["mean"],
|
||
|
"fields": "",
|
||
|
"values": true
|
||
|
},
|
||
|
"textMode": "value"
|
||
|
},
|
||
|
"pluginVersion": "8.3.4",
|
||
|
"targets": [
|
||
|
{
|
||
|
"format": "time_series",
|
||
|
"group": [],
|
||
|
"metricColumn": "none",
|
||
|
"rawQuery": true,
|
||
|
"rawSql": "select 1 - sum(duration_min) / (EXTRACT(EPOCH FROM (max(end_date) - min(start_date))) / 60), 1 as time from drives where car_id = $car_id;",
|
||
|
"refId": "A",
|
||
|
"select": [
|
||
|
[
|
||
|
{
|
||
|
"params": ["latitude"],
|
||
|
"type": "column"
|
||
|
}
|
||
|
]
|
||
|
],
|
||
|
"table": "addresses",
|
||
|
"timeColumn": "inserted_at",
|
||
|
"timeColumnType": "timestamp",
|
||
|
"where": [
|
||
|
{
|
||
|
"name": "$__timeFilter",
|
||
|
"params": [],
|
||
|
"type": "macro"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"title": "parked (%)",
|
||
|
"type": "stat"
|
||
|
},
|
||
|
{
|
||
|
"datasource": "TeslaMate",
|
||
|
"fieldConfig": {
|
||
|
"defaults": {
|
||
|
"color": {
|
||
|
"mode": "continuous-GrYlRd"
|
||
|
},
|
||
|
"custom": {
|
||
|
"fillOpacity": 100,
|
||
|
"lineWidth": 0
|
||
|
},
|
||
|
"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
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"unit": "short"
|
||
|
},
|
||
|
"overrides": []
|
||
|
},
|
||
|
"gridPos": {
|
||
|
"h": 7,
|
||
|
"w": 24,
|
||
|
"x": 0,
|
||
|
"y": 3
|
||
|
},
|
||
|
"id": 14,
|
||
|
"options": {
|
||
|
"alignValue": "center",
|
||
|
"legend": {
|
||
|
"displayMode": "list",
|
||
|
"placement": "bottom"
|
||
|
},
|
||
|
"mergeValues": true,
|
||
|
"rowHeight": 0.9,
|
||
|
"showValue": "auto",
|
||
|
"tooltip": {
|
||
|
"mode": "single"
|
||
|
}
|
||
|
},
|
||
|
"targets": [
|
||
|
{
|
||
|
"format": "time_series",
|
||
|
"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": "addresses",
|
||
|
"timeColumn": "inserted_at",
|
||
|
"timeColumnType": "timestamp",
|
||
|
"where": [
|
||
|
{
|
||
|
"name": "$__timeFilter",
|
||
|
"params": [],
|
||
|
"type": "macro"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"title": "States",
|
||
|
"type": "state-timeline"
|
||
|
}
|
||
|
],
|
||
|
"refresh": false,
|
||
|
"schemaVersion": 36,
|
||
|
"style": "dark",
|
||
|
"tags": ["tesla"],
|
||
|
"templating": {
|
||
|
"list": [
|
||
|
{
|
||
|
"current": {
|
||
|
"selected": false,
|
||
|
"text": "All",
|
||
|
"value": "$__all"
|
||
|
},
|
||
|
"datasource": "TeslaMate",
|
||
|
"definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
|
||
|
"hide": 2,
|
||
|
"includeAll": true,
|
||
|
"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": {
|
||
|
"selected": false,
|
||
|
"text": "http://localhost:4000",
|
||
|
"value": "http://localhost:4000"
|
||
|
},
|
||
|
"datasource": "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
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"time": {
|
||
|
"from": "now-2d",
|
||
|
"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": "States",
|
||
|
"uid": "xo4BNRkZz",
|
||
|
"version": 1,
|
||
|
"weekStart": ""
|
||
|
}
|