{
"__elements": {},
"__requires": [
{
"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": "table",
"name": "Table",
"version": ""
},
{
"type": "panel",
"id": "text",
"name": "Text",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"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": 1,
"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": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 5,
"x": 0,
"y": 0
},
"id": 32,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "/.*/",
"values": false
},
"textMode": "value_and_name"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT ROUND(convert_km((max(odometer) - min(odometer))::numeric, '$length_unit'),0)|| ' $length_unit' as \"Logged\"\nfrom positions where car_id = $car_id;",
"refId": "DistanceLogged",
"select": [
[
{
"params": ["efficiency"],
"type": "column"
}
]
],
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select ROUND(convert_km(ROUND(odometer::numeric,0), '$length_unit'),0) || ' $length_unit' as \"Odometer\"\nfrom positions \nwhere car_id = $car_id\norder by date desc \nlimit 1;",
"refId": "Odometer",
"select": [
[
{
"params": ["efficiency"],
"type": "column"
}
]
],
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Mileage",
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 5,
"x": 5,
"y": 0
},
"id": 36,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "/.*/",
"values": false
},
"textMode": "value_and_name"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT COUNT(id) AS \"Charges\" FROM charging_processes WHERE car_id=$car_id \n",
"refId": "Charges",
"select": [
[
{
"params": ["efficiency"],
"type": "column"
}
]
],
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT COUNT(id) AS \"Drives\" FROM drives WHERE car_id=$car_id ",
"refId": "Drives",
"select": [
[
{
"params": ["efficiency"],
"type": "column"
}
]
],
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Stats",
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 5,
"x": 10,
"y": 0
},
"id": 39,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "/.*/",
"values": false
},
"textMode": "value_and_name"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT COUNT(id) as \"NÂș Car Updates\"\nFROM Updates \nWHERE car_id = $car_id\n",
"refId": "Car Updates",
"select": [
[
{
"params": ["efficiency"],
"type": "column"
}
]
],
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"hide": false,
"rawQuery": true,
"rawSql": "select split_part(version, ' ', 1) as \"Current Car Firmware\" \r\nfrom updates \r\nwhere car_id = $car_id \r\norder by start_date desc \r\nlimit 1",
"refId": "Firmware",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "Software",
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 5,
"x": 15,
"y": 0
},
"id": 42,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "/.*/",
"values": false
},
"textMode": "value_and_name"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT COUNT(id) as \"Charges not closed\"\nFROM charging_processes \nWHERE car_id = $car_id AND end_date is null\n",
"refId": "Charges",
"select": [
[
{
"params": ["efficiency"],
"type": "column"
}
]
],
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT COUNT(id) AS \"Drives not closed\"\r\nFROM drives \r\nWHERE car_id = $car_id AND end_date is null",
"refId": "Drives",
"select": [
[
{
"params": ["efficiency"],
"type": "column"
}
]
],
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Incomplete Data",
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"gridPos": {
"h": 4,
"w": 4,
"x": 20,
"y": 0
},
"id": 40,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
},
"content": "You can go to the \nIncomplete Data dashboard
\nto see details of the **Drives** or **Charges** not closed.\n",
"mode": "markdown"
},
"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"
}
]
}
],
"title": "About incomplete data",
"type": "text"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 4
},
"id": 34,
"panels": [],
"title": "Database Information",
"type": "row"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Size"
},
"properties": [
{
"id": "custom.align",
"value": "right"
},
{
"id": "custom.width",
"value": 150
}
]
}
]
},
"gridPos": {
"h": 16,
"w": 5,
"x": 0,
"y": 5
},
"id": 33,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": ["sum"],
"show": false
},
"showHeader": true
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT \r\n relname AS \"Table\",\r\n pg_size_pretty(pg_total_relation_size(relid)) As \"Size\"\r\nFROM \r\n pg_catalog.pg_statio_user_tables\r\nORDER BY \r\n pg_total_relation_size(relid) DESC;",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"type": "table"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Row Count"
},
"properties": [
{
"id": "custom.align",
"value": "right"
},
{
"id": "custom.width",
"value": 150
}
]
}
]
},
"gridPos": {
"h": 16,
"w": 5,
"x": 5,
"y": 5
},
"id": 38,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": ["sum"],
"show": false
},
"showHeader": true
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT table_name AS \"Table Name\", \r\n (xpath('/row/cnt/text()', xml_count))[1]::text::int AS \"Row Count\"\r\nFROM (\r\n SELECT table_name, \r\n query_to_xml(format('SELECT count(*) as cnt FROM %I.%I', table_schema, table_name), false, true, '') AS xml_count\r\n FROM information_schema.tables\r\n WHERE table_schema NOT IN ('pg_catalog', 'information_schema')\r\n) AS t\r\nORDER BY 2 DESC;",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"type": "table"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"description": "These statistics can help you evaluate the efficiency of your indexes.\n\nYou should reindex all the database periodically.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 16,
"w": 14,
"x": 10,
"y": 5
},
"id": 41,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"enablePagination": true,
"fields": "",
"reducer": ["sum"],
"show": false
},
"showHeader": true
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT\r\n relname AS \"Table\",\r\n indexrelname AS \"Index\",\r\n idx_scan AS \"Index Scans\",\r\n idx_tup_read AS \"Tuples Read\",\r\n idx_tup_fetch AS \"Tuples Fetched\"\r\nFROM\r\n pg_stat_all_indexes\r\nWHERE\r\n schemaname NOT LIKE 'pg_%' AND\r\n indexrelname IS NOT NULL\r\nORDER BY 3 DESC;",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "Indexes",
"type": "table"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 10,
"x": 0,
"y": 21
},
"id": 35,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "/.*/",
"values": false
},
"textMode": "value"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT \n pg_size_pretty(SUM(pg_total_relation_size(relid))) As \"Size\"\nFROM \n pg_catalog.pg_statio_user_tables;",
"refId": "DistanceLogged",
"select": [
[
{
"params": ["efficiency"],
"type": "column"
}
]
],
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Database Total Size",
"type": "stat"
},
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"links": [
{
"targetBlank": true,
"title": "Click to check last Version",
"url": "https://github.com/jheredianet/Teslamate-CustomGrafanaDashboards/releases/"
}
],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 14,
"x": 10,
"y": 21
},
"id": 43,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "/.*/",
"values": false
},
"textMode": "value_and_name"
},
"pluginVersion": "10.1.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"hide": false,
"rawQuery": true,
"rawSql": "SELECT '2024.04.02' AS \"Current Version\"",
"refId": "DashboardVersion",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "About Teslamate Custom Dashboards",
"type": "stat"
}
],
"refresh": "",
"schemaVersion": 38,
"style": "dark",
"tags": ["TeslamateCustomDashboards"],
"templating": {
"list": [
{
"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 name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"description": "",
"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"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"hidden": true,
"refresh_intervals": []
},
"timezone": "browser",
"title": "Database Information",
"uid": "jchm_dbInfo",
"version": 3,
"weekStart": ""
}