TrueChartsClone/charts/incubator/teslamate/dashboards/teslamate1/timeline.json

825 lines
41 KiB
JSON
Raw Normal View History

feat(teslamate) Add teslamate (#20123) **Description** Add teslamate **⚙️ Type of change** - [X] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** <!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration --> **📃 Notes:** <!-- Please enter any other relevant information here --> **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [x] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [x] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [x] ⬆️ I increased versions for any altered app according to semantic versioning - [X] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):` or `chore(chart-name):` **➕ App addition** If this PR is an app addition please make sure you have done the following. - [X] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._
2024-04-13 10:34:04 +00:00
{
"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": 1642862616523,
"links": [
{
"asDropdown": false,
"icon": "dashboard",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": false,
"title": "TeslaMate",
"tooltip": "",
"type": "link",
"url": "[[base_url:raw]]"
},
{
"asDropdown": true,
"icon": "external link",
"includeVars": false,
"keepTime": false,
"tags": ["tesla"],
"targetBlank": false,
"title": "Dashboards",
"tooltip": "",
"type": "dashboards",
"url": ""
}
],
"liveNow": false,
"panels": [
{
"collapsed": false,
"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": {
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Start"
},
"properties": [
{
"id": "unit",
"value": "dateTimeAsLocal"
},
{
"id": "custom.width",
"value": 180
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "d/FkUpJpQZk/trip?from=${__data.fields.start_date_ts}&to=${__data.fields.end_date_ts}&var-car_id=$car_id"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "SoC"
},
"properties": [
{
"id": "custom.width",
"value": 70
},
{
"id": "unit",
"value": "percent"
}
]
},
{
"matcher": {
"id": "byName",
"options": "SoC Diff"
},
"properties": [
{
"id": "custom.width",
"value": 70
},
{
"id": "unit",
"value": "percent"
}
]
},
{
"matcher": {
"id": "byName",
"options": "start_path"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "end_path"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "Action"
},
"properties": [
{
"id": "custom.width",
"value": 150
},
{
"id": "custom.filterable",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "kWh"
},
"properties": [
{
"id": "custom.width",
"value": 100
},
{
"id": "unit",
"value": "kwatth"
},
{
"id": "decimals",
"value": 1
}
]
},
{
"matcher": {
"id": "byName",
"options": "End"
},
"properties": [
{
"id": "unit",
"value": "dateTimeAsLocal"
},
{
"id": "custom.width",
"value": 152
}
]
},
{
"matcher": {
"id": "byName",
"options": "Duration"
},
"properties": [
{
"id": "unit",
"value": "m"
},
{
"id": "custom.width",
"value": 100
}
]
},
{
"matcher": {
"id": "byName",
"options": "Start Address"
},
"properties": [
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "Create or edit geo-fence",
"url": "[[base_url:raw]]/geo-fences/${__data.fields.start_path:raw}"
}
]
},
{
"id": "custom.filterable",
"value": true
},
{
"id": "custom.minWidth",
"value": 200
}
]
},
{
"matcher": {
"id": "byName",
"options": "End Address"
},
"properties": [
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "Create or edit geo-fence",
"url": "[[base_url:raw]]/geo-fences/${__data.fields.end_path:raw}"
}
]
},
{
"id": "custom.filterable",
"value": true
},
{
"id": "custom.minWidth",
"value": 200
}
]
},
{
"matcher": {
"id": "byName",
"options": "start_date_ts"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "end_date_ts"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "odometer_km"
},
"properties": [
{
"id": "custom.width",
"value": 100
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/.*_km/"
},
"properties": [
{
"id": "unit",
"value": "km"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/.*_mi/"
},
"properties": [
{
"id": "unit",
"value": "mi"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/.*_c/"
},
"properties": [
{
"id": "unit",
"value": "celsius"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/.*_f/"
},
"properties": [
{
"id": "unit",
"value": "fahrenheit"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/odometer_.*/"
},
"properties": [
{
"id": "displayName",
"value": "Odometer"
},
{
"id": "custom.width",
"value": 100
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/distance_.*/"
},
"properties": [
{
"id": "displayName",
"value": "Distance"
},
{
"id": "custom.width",
"value": 100
},
{
"id": "decimals",
"value": 1
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/range_diff_.*/"
},
"properties": [
{
"id": "displayName",
"value": "Range Diff"
},
{
"id": "custom.width",
"value": 100
},
{
"id": "decimals",
"value": 1
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/outside_temp_avg_.*/"
},
"properties": [
{
"id": "displayName",
"value": "Temperature"
},
{
"id": "custom.width",
"value": 100
},
{
"id": "decimals",
"value": 1
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/end_range_.*/"
},
"properties": [
{
"id": "displayName",
"value": "Range"
},
{
"id": "custom.width",
"value": 100
}
]
},
{
"matcher": {
"id": "byName",
"options": "Range"
},
"properties": [
{
"id": "custom.width",
"value": 118
}
]
},
{
"matcher": {
"id": "byName",
"options": "Action"
},
"properties": [
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "Slot details",
"url": "${__data.fields.slotlink:raw}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "slotlink"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
}
]
},
"gridPos": {
"h": 22,
"w": 24,
"x": 0,
"y": 1
},
"id": 2,
"options": {
"footer": {
"fields": "",
"reducer": ["sum"],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Start"
}
]
},
"pluginVersion": "8.3.4",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\r\n start_date AS \"Start\",\r\n end_date AS \"End\",\r\n ROUND(EXTRACT(EPOCH FROM start_date))*1000 AS start_date_ts,\r\n ROUND(EXTRACT(EPOCH FROM end_date))*1000 AS end_date_ts,\r\n '🚗 Driving' AS \"Action\",\r\n drives.duration_min AS \"Duration\",\r\n CASE WHEN start_geofence_id IS NULL THEN CONCAT('new?lat=', TP1.latitude, '&lng=', TP1.longitude)\r\n WHEN start_geofence_id IS NOT NULL THEN CONCAT(start_geofence_id, '/edit')\r\n END AS start_path,\r\n CASE WHEN end_geofence_id IS NULL THEN CONCAT('new?lat=', TP2.latitude, '&lng=', TP2.longitude)\r\n WHEN start_geofence_id IS NOT NULL THEN CONCAT(end_geofence_id, '/edit')\r\n END AS end_path,\r\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS \"Start Address\",\r\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS \"End Address\",\r\n convert_km(end_km::NUMERIC, '$length_unit') AS odometer_$length_unit,\r\n convert_km(distance::NUMERIC, '$length_unit') AS distance_$length_unit,\r\n convert_km(end_[[preferred_range]]_range_km::NUMERIC, '$length_unit') AS end_range_$length_unit,\r\n convert_km((end_[[preferred_range]]_range_km - start_[[preferred_range]]_range_km)::NUMERIC, '$length_unit') * efficiency AS \"kWh\",\r\n convert_km((end_[[preferred_range]]_range_km - start_[[preferred_range]]_range_km)::NUMERIC, '$length_unit') AS range_diff_$length_unit,\r\n TP2.battery_level AS \"SoC\",\r\n TP2.battery_level-TP1.battery_level AS \"SoC Diff\",\r\n convert_celsius(outside_temp_avg, '$temp_unit') AS outside_temp_avg_$temp_unit,\r\n CONCAT('d/zm7wN6Zgz/drive-details?from=', ROUND(EXTRACT(EPOCH FROM start_date))*1000, '&to=', ROUND(EXTRACT(EPOCH FROM end_date))*1000, '&var-car_id=', drives.car_id, '&var-drive_id=', drives.id) AS slotlink\r\nFROM drives\r\n LEFT OUTER JOIN positions AS TP1 on drives.start_position_id = TP1.id\r\n LEFT OUTER JOIN positions AS TP2 on drives.end_position_id = TP2.id\r\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\r\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\r\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\r\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\r\n JOIN cars ON cars.id = drives.car_id\r\nWHERE \r\n $__timeFilter(drives.start_date)\r\n AND drives.car_id = $car_id\r\n AND '🚗 Driving' in ($action_filter)\r\n AND\r\n (COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city))::TEXT like '%$text_filter%' or\r\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city))::TEXT like '%$text_filter%')\r\n\r\nUNION\r\nSELECT\r\n start_date AS \"Start\",\r\n end_date AS \"End\",\r\n ROUND(EXTRACT(EPOCH FROM start_date))*1000 AS start_date_ts,\r\n ROUND(EXTRACT(EPOCH FROM end_date))*1000 AS end_date_ts,\r\n '🔋 Charging' AS \"Action\",\r\n charging_processes.duration_min AS \"Duration\",\r\n CASE WHEN geofence_id IS NULL THEN CONCAT('new?lat=', address.latitude, '&lng=', address.longitude)\r\n WHEN geofence_id IS NOT NULL THEN CONCAT(geofence_id, '/edit')\r\n END AS start_path,\r\n NULL AS end_path,\r\n COALESCE(geofence.name, CONCAT_WS(', ', COALESCE(address.name, nullif(CONCAT_WS(' ', address.road, address.house_number), '')), address.city)) AS \"Start Address\",\r\n '' AS \"End Address\",\r\n convert_km(position.odometer::NUMERIC, '$length_unit') AS odometer_$length_unit,\r\n NULL AS distance_$length_unit,\r\n convert_km(end_[[preferred_range]]_range_km::NUMERIC, '$length_unit') AS end_range_$length_unit,\r\n charging_processes.charge_energy_added AS \"kWh\",\r\n co
"refId": "A",
"select": [
[
{
"params": ["id"],
"type": "column"
}
]
],
"table": "candata",
"timeColumn": "datum",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Timeline",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"End": true,
"start_date_ts": false
},
"indexByName": {
"Action": 2,
"Duration": 7,
"End": 1,
"End Address": 4,
"SoC": 15,
"SoC Diff": 16,
"Start": 0,
"Start Address": 3,
"distance_km": 8,
"distance_mi": 9,
"end_date_ts": 22,
"end_path": 20,
"end_range_km": 10,
"end_range_mi": 11,
"kWh": 13,
"odometer_km": 5,
"odometer_mi": 6,
"outside_temp_avg_c": 17,
"outside_temp_avg_f": 18,
"range_diff_km": 12,
"range_diff_mi": 13,
"start_date_ts": 21,
"start_path": 19
},
"renameByName": {
"action": "",
"end_address": "End",
"km_diff": "Km",
"kwh": "",
"minutediff": "Time",
"odometer": "",
"outside_temp_avg": "Temperature",
"rangediff": "Range Difference",
"soc": "",
"soc_diff": "SoC Difference",
"start_address": "Start",
"start_date": "Date",
"start_date_ts": ""
}
}
}
],
"type": "table"
}
],
"refresh": "1h",
"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,
"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": {
"selected": false,
"text": ["All"],
"value": ["$__all"]
},
"hide": 0,
"includeAll": true,
"label": "Action",
"multi": true,
"name": "action_filter",
"options": [
{
"selected": true,
"text": "All",
"value": "$__all"
},
{
"selected": false,
"text": "🚗 Driving",
"value": "🚗 Driving"
},
{
"selected": false,
"text": "🔋 Charging",
"value": "🔋 Charging"
},
{
"selected": false,
"text": "🅿️ Parking",
"value": "🅿️ Parking"
},
{
"selected": false,
"text": "❓ Missing",
"value": "❓ Missing"
},
{
"selected": false,
"text": "💾 Updating",
"value": "💾 Updating"
}
],
"query": "🚗 Driving,🔋 Charging,🅿️ Parking,❓ Missing,💾 Updating",
"queryValue": "",
"skipUrlSync": false,
"type": "custom"
},
{
"current": {
"selected": false,
"text": "",
"value": ""
},
"hide": 0,
"label": "Text Filter",
"name": "text_filter",
"options": [
{
"selected": true,
"text": "",
"value": ""
}
],
"query": "",
"skipUrlSync": false,
"type": "textbox"
},
{
"current": {
"selected": false,
"text": "km",
"value": "km"
},
"datasource": "TeslaMate",
"definition": "select unit_of_length from settings limit 1;",
"hide": 2,
"includeAll": false,
"label": "length unit",
"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": "C",
"value": "C"
},
"datasource": "TeslaMate",
"definition": "select unit_of_temperature from settings limit 1;",
"hide": 2,
"includeAll": false,
"label": "temperature unit",
"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": {
"selected": false,
"text": "ideal",
"value": "ideal"
},
"datasource": "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
}
]
},
"time": {
"from": "now-14d",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Timeline",
"uid": "SUBgwtigz",
"version": 1,
"weekStart": ""
}