318 lines
9.9 KiB
JSON
318 lines
9.9 KiB
JSON
{
|
|
"annotations": {
|
|
"list": [
|
|
{
|
|
"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": 1656100778202,
|
|
"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": 4,
|
|
"panels": [],
|
|
"repeat": "car_id",
|
|
"title": "$car_id",
|
|
"type": "row"
|
|
},
|
|
{
|
|
"datasource": "TeslaMate",
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {
|
|
"mode": "palette-classic"
|
|
},
|
|
"custom": {
|
|
"axisLabel": "",
|
|
"axisPlacement": "auto",
|
|
"barAlignment": 0,
|
|
"drawStyle": "line",
|
|
"fillOpacity": 20,
|
|
"gradientMode": "opacity",
|
|
"hideFrom": {
|
|
"legend": false,
|
|
"tooltip": false,
|
|
"viz": false
|
|
},
|
|
"lineInterpolation": "stepAfter",
|
|
"lineWidth": 1,
|
|
"pointSize": 5,
|
|
"scaleDistribution": {
|
|
"type": "linear"
|
|
},
|
|
"showPoints": "never",
|
|
"spanNulls": true,
|
|
"stacking": {
|
|
"group": "A",
|
|
"mode": "none"
|
|
},
|
|
"thresholdsStyle": {
|
|
"mode": "off"
|
|
}
|
|
},
|
|
"decimals": 0,
|
|
"links": [],
|
|
"mappings": [],
|
|
"thresholds": {
|
|
"mode": "absolute",
|
|
"steps": [
|
|
{
|
|
"color": "green",
|
|
"value": null
|
|
},
|
|
{
|
|
"color": "red",
|
|
"value": 80
|
|
}
|
|
]
|
|
},
|
|
"unit": "short"
|
|
},
|
|
"overrides": [
|
|
{
|
|
"matcher": {
|
|
"id": "byRegexp",
|
|
"options": ".*_km$"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "unit",
|
|
"value": "km"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byRegexp",
|
|
"options": ".*_mi$"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "unit",
|
|
"value": "mi"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"matcher": {
|
|
"id": "byRegexp",
|
|
"options": "mileage_.*"
|
|
},
|
|
"properties": [
|
|
{
|
|
"id": "displayName",
|
|
"value": "Mileage"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"gridPos": {
|
|
"h": 21,
|
|
"w": 24,
|
|
"x": 0,
|
|
"y": 1
|
|
},
|
|
"id": 2,
|
|
"links": [],
|
|
"options": {
|
|
"legend": {
|
|
"calcs": ["min", "max"],
|
|
"displayMode": "table",
|
|
"placement": "bottom"
|
|
},
|
|
"tooltip": {
|
|
"mode": "multi",
|
|
"sort": "none"
|
|
}
|
|
},
|
|
"pluginVersion": "8.5.4",
|
|
"targets": [
|
|
{
|
|
"alias": "",
|
|
"datasource": "TeslaMate",
|
|
"format": "time_series",
|
|
"group": [],
|
|
"hide": false,
|
|
"metricColumn": "none",
|
|
"rawQuery": true,
|
|
"rawSql": "WITH o AS (SELECT\n start_date AS time,\n car_id,\n start_km AS \"odometer\"\nFROM drives\nUNION ALL\nSELECT\n end_date,\n car_id,\n end_km AS \"odometer\"\nFROM drives)\n\nSELECT\n time, \n convert_km(odometer::numeric, '$length_unit') as mileage_$length_unit\nFROM o\nWHERE\n\tcar_id = $car_id AND\n\t$__timeFilter(time)\norder by 1;",
|
|
"refId": "A",
|
|
"select": [
|
|
[
|
|
{
|
|
"params": ["value"],
|
|
"type": "column"
|
|
}
|
|
]
|
|
],
|
|
"timeColumn": "time",
|
|
"where": [
|
|
{
|
|
"name": "$__timeFilter",
|
|
"params": [],
|
|
"type": "macro"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"title": "Mileage",
|
|
"type": "timeseries"
|
|
}
|
|
],
|
|
"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": "km",
|
|
"value": "km"
|
|
},
|
|
"datasource": "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": {
|
|
"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-6M",
|
|
"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": "Mileage",
|
|
"uid": "NjtMTFggz",
|
|
"version": 1,
|
|
"weekStart": ""
|
|
}
|