Files
archived-hipudding-teslamate/grafana/dashboards/drives.json
2025-02-22 09:13:42 +01:00

1636 lines
43 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,
"links": [
{
"icon": "dashboard",
"tags": [],
"title": "TeslaMate",
"tooltip": "",
"type": "link",
"url": "${base_url:raw}"
},
{
"asDropdown": true,
"icon": "external link",
"tags": [
"tesla"
],
"title": "Dashboards",
"type": "dashboards"
}
],
"panels": [
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 3,
"panels": [],
"title": "Summary of this period",
"type": "row"
},
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
},
"unit": "kwatth"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "consumption_kWh"
},
"properties": [
{
"id": "displayName",
"value": "Total Energy consumed (net):"
}
]
}
]
},
"gridPos": {
"h": 2,
"w": 6,
"x": 0,
"y": 1
},
"id": 4,
"maxDataPoints": 100,
"options": {
"colorMode": "background",
"graphMode": "none",
"justifyMode": "center",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"sum"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.5.2",
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 2,
"refId": "A"
}
],
"title": "",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"consumption_kWh"
]
}
}
}
],
"transparent": true,
"type": "stat"
},
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 0,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
},
"unit": "m"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "duration_min"
},
"properties": [
{
"id": "displayName",
"value": "Total Duration:"
}
]
}
]
},
"gridPos": {
"h": 2,
"w": 6,
"x": 6,
"y": 1
},
"id": 5,
"maxDataPoints": 100,
"options": {
"colorMode": "background",
"graphMode": "none",
"justifyMode": "center",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"sum"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.5.2",
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 2,
"refId": "A"
}
],
"title": "",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"duration_min"
]
}
}
}
],
"transparent": true,
"type": "stat"
},
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 0,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "distance_mi"
},
"properties": [
{
"id": "unit",
"value": "mi"
},
{
"id": "displayName",
"value": "Total Distance logged:"
}
]
},
{
"matcher": {
"id": "byName",
"options": "distance_km"
},
"properties": [
{
"id": "unit",
"value": "km"
},
{
"id": "displayName",
"value": "Total Distance logged:"
}
]
}
]
},
"gridPos": {
"h": 2,
"w": 6,
"x": 12,
"y": 1
},
"id": 6,
"maxDataPoints": 100,
"options": {
"colorMode": "background",
"graphMode": "none",
"justifyMode": "center",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"sum"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.5.2",
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 2,
"refId": "A"
}
],
"title": "",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"distance_mi",
"distance_km"
]
}
}
}
],
"transparent": true,
"type": "stat"
},
{
"datasource": {
"default": false,
"type": "datasource",
"uid": "-- Dashboard --"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 0,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "consumption_kwh_mi"
},
"properties": [
{
"id": "unit",
"value": "Wh/mi"
},
{
"id": "displayName",
"value": "Ø Consumption (net):"
}
]
},
{
"matcher": {
"id": "byName",
"options": "consumption_kwh_km"
},
"properties": [
{
"id": "unit",
"value": "Wh/km"
},
{
"id": "displayName",
"value": "Ø Consumption (net):"
}
]
}
]
},
"gridPos": {
"h": 2,
"w": 6,
"x": 18,
"y": 1
},
"id": 7,
"maxDataPoints": 100,
"options": {
"colorMode": "background",
"graphMode": "none",
"justifyMode": "center",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.5.2",
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 2,
"refId": "A"
}
],
"title": "",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"pattern": "distance_km|distance_mi|consumption_kWh"
}
}
},
{
"id": "renameByRegex",
"options": {
"regex": "distance_(mi|km)",
"renamePattern": "distance"
}
},
{
"id": "reduce",
"options": {
"includeTimeField": false,
"mode": "reduceFields",
"reducers": [
"sum"
]
}
},
{
"id": "calculateField",
"options": {
"binary": {
"left": "consumption_kWh",
"operator": "/",
"right": "distance"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"replaceFields": true
}
},
{
"id": "calculateField",
"options": {
"alias": "consumption_kwh_$length_unit",
"binary": {
"left": "1000",
"operator": "*",
"right": "consumption_kWh / distance"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"replaceFields": true
}
}
],
"transparent": true,
"type": "stat"
},
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"filterable": false,
"inspect": false,
"minWidth": 150
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "start_date"
},
"properties": [
{
"id": "displayName",
"value": "Date"
},
{
"id": "unit",
"value": "dateTimeAsLocal"
},
{
"id": "links",
"value": [
{
"targetBlank": false,
"title": "View drive details",
"url": "/d/zm7wN6Zgz/drive-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-drive_id=${__data.fields.drive_id.numeric}"
}
]
},
{
"id": "custom.minWidth",
"value": 180
}
]
},
{
"matcher": {
"id": "byName",
"options": "consumption_kwh_km"
},
"properties": [
{
"id": "displayName",
"value": "Ø Consumption (net)"
},
{
"id": "unit",
"value": "Wh/km"
},
{
"id": "custom.minWidth",
"value": 165
}
]
},
{
"matcher": {
"id": "byName",
"options": "consumption_kwh_mi"
},
"properties": [
{
"id": "displayName",
"value": "Ø Consumption (net)"
},
{
"id": "unit",
"value": "Wh/mi"
},
{
"id": "custom.minWidth",
"value": 165
}
]
},
{
"matcher": {
"id": "byName",
"options": "distance_km"
},
"properties": [
{
"id": "displayName",
"value": "Distance"
},
{
"id": "unit",
"value": "lengthkm"
},
{
"id": "decimals",
"value": 1
},
{
"id": "custom.minWidth",
"value": 90
}
]
},
{
"matcher": {
"id": "byName",
"options": "consumption_kWh"
},
"properties": [
{
"id": "displayName",
"value": "Energy consumed (net)"
},
{
"id": "unit",
"value": "kwatth"
},
{
"id": "decimals",
"value": 1
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "super-light-green",
"value": null
},
{
"color": "green",
"value": 20
},
{
"color": "dark-green",
"value": 30
}
]
}
},
{
"id": "custom.minWidth",
"value": 180
}
]
},
{
"matcher": {
"id": "byName",
"options": "start_address"
},
"properties": [
{
"id": "displayName",
"value": "Start"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "Create or edit geo-fence",
"url": "${base_url:raw}/geo-fences/${__data.fields.start_path}"
}
]
},
{
"id": "custom.minWidth",
"value": 200
}
]
},
{
"matcher": {
"id": "byName",
"options": "end_address"
},
"properties": [
{
"id": "displayName",
"value": "Destination"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "Create or edit geo-fence",
"url": "${base_url:raw}/geo-fences/${__data.fields.end_path}"
}
]
},
{
"id": "custom.minWidth",
"value": 200
}
]
},
{
"matcher": {
"id": "byName",
"options": "outside_temp_c"
},
"properties": [
{
"id": "displayName",
"value": "Temp"
},
{
"id": "unit",
"value": "celsius"
},
{
"id": "decimals",
"value": 1
},
{
"id": "custom.minWidth",
"value": 70
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
},
{
"color": "super-light-green",
"value": 10
},
{
"color": "super-light-red",
"value": 20
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "duration_min"
},
"properties": [
{
"id": "displayName",
"value": "Duration"
},
{
"id": "unit",
"value": "m"
},
{
"id": "decimals",
"value": 1
},
{
"id": "custom.minWidth",
"value": 90
}
]
},
{
"matcher": {
"id": "byName",
"options": "efficiency"
},
"properties": [
{
"id": "displayName",
"value": "Efficiency"
},
{
"id": "unit",
"value": "percentunit"
},
{
"id": "custom.cellOptions",
"value": {
"mode": "lcd",
"type": "gauge"
}
},
{
"id": "max",
"value": 1.25
},
{
"id": "min",
"value": 0
},
{
"id": "color",
"value": {
"mode": "thresholds"
}
},
{
"id": "custom.minWidth",
"value": 120
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "super-light-orange",
"value": null
},
{
"color": "light-orange",
"value": 0.65
},
{
"color": "green",
"value": 0.99
}
]
}
},
{
"id": "decimals"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/.*_ts/"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "speed_avg_km"
},
"properties": [
{
"id": "displayName",
"value": "Ø Speed"
},
{
"id": "unit",
"value": "velocitykmh"
},
{
"id": "decimals",
"value": 0
},
{
"id": "custom.minWidth",
"value": 90
}
]
},
{
"matcher": {
"id": "byName",
"options": "id"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "distance_mi"
},
"properties": [
{
"id": "displayName",
"value": "Distance"
},
{
"id": "unit",
"value": "lengthmi"
},
{
"id": "decimals",
"value": 1
},
{
"id": "custom.minWidth",
"value": 90
}
]
},
{
"matcher": {
"id": "byName",
"options": "outside_temp_f"
},
"properties": [
{
"id": "displayName",
"value": "Temp"
},
{
"id": "unit",
"value": "fahrenheit"
},
{
"id": "decimals",
"value": 1
},
{
"id": "custom.minWidth",
"value": 70
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "super-light-blue",
"value": null
},
{
"color": "super-light-green",
"value": 50
},
{
"color": "super-light-red",
"value": 68
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "speed_avg_mi"
},
"properties": [
{
"id": "displayName",
"value": "Ø Speed"
},
{
"id": "unit",
"value": "velocitymph"
},
{
"id": "decimals",
"value": 0
},
{
"id": "custom.minWidth",
"value": 90
}
]
},
{
"matcher": {
"id": "byName",
"options": "speed_max_mi"
},
"properties": [
{
"id": "displayName",
"value": "max Speed"
},
{
"id": "unit",
"value": "velocitymph"
},
{
"id": "decimals",
"value": 0
},
{
"id": "custom.minWidth",
"value": 95
}
]
},
{
"matcher": {
"id": "byName",
"options": "speed_max_km"
},
"properties": [
{
"id": "displayName",
"value": "max Speed"
},
{
"id": "unit",
"value": "velocitykmh"
},
{
"id": "decimals",
"value": 0
},
{
"id": "custom.minWidth",
"value": 95
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/(start|end)_path/"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "duration_str"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "car_id"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "% Start"
},
"properties": [
{
"id": "unit",
"value": "percent"
},
{
"id": "decimals",
"value": 0
},
{
"id": "custom.minWidth",
"value": 75
}
]
},
{
"matcher": {
"id": "byName",
"options": "% End"
},
"properties": [
{
"id": "unit",
"value": "percent"
},
{
"id": "decimals",
"value": 0
},
{
"id": "custom.minWidth",
"value": 65
}
]
},
{
"matcher": {
"id": "byName",
"options": "has_reduced_range"
},
"properties": [
{
"id": "displayName",
"value": "❄"
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "custom.align",
"value": "center"
},
{
"id": "mappings",
"value": [
{
"options": {
"false": {
"color": "transparent",
"index": 1,
"text": "."
},
"true": {
"color": "dark-blue",
"index": 0,
"text": "❄"
}
},
"type": "value"
}
]
},
{
"id": "custom.minWidth",
"value": 50
}
]
},
{
"matcher": {
"id": "byName",
"options": "drive_id"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "power_max"
},
"properties": [
{
"id": "displayName",
"value": "max Power"
},
{
"id": "unit",
"value": "kwatt"
},
{
"id": "custom.minWidth",
"value": 90
}
]
}
]
},
"gridPos": {
"h": 19,
"w": 24,
"x": 0,
"y": 3
},
"id": 2,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"enablePagination": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": []
},
"pluginVersion": "11.5.2",
"targets": [
{
"alias": "",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n car.id as car_id,\n CASE WHEN start_geofence.id IS NULL THEN CONCAT('new?lat=', start_position.latitude, '&lng=', start_position.longitude)\n WHEN start_geofence.id IS NOT NULL THEN CONCAT(start_geofence.id, '/edit')\n END as start_path,\n CASE WHEN end_geofence.id IS NULL THEN CONCAT('new?lat=', end_position.latitude, '&lng=', end_position.longitude)\n WHEN end_geofence.id IS NOT NULL THEN CONCAT(end_geofence.id, '/edit')\n END as end_path,\n TO_CHAR((duration_min * INTERVAL '1 minute'), 'HH24:MI') as duration_str,\n drives.id as drive_id,\n -- Columns\n start_date,\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,\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,\n duration_min,\n distance,\n start_position.usable_battery_level as start_usable_battery_level,\n start_position.battery_level as start_battery_level,\n end_position.usable_battery_level as end_usable_battery_level,\n end_position.battery_level as end_battery_level,\n case when (start_position.battery_level != start_position.usable_battery_level OR end_position.battery_level != end_position.usable_battery_level) = true then true else false end as reduced_range,\n duration_min > 1 AND distance > 1 AND ( \n start_position.usable_battery_level IS NULL OR end_position.usable_battery_level IS NULL\tOR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) as is_sufficiently_precise,\n NULLIF(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0), 0) as range_diff,\n car.efficiency as car_efficiency,\n outside_temp_avg,\n distance / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 AS avg_speed,\n\tspeed_max,\n power_max\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id \n AND convert_km(distance::numeric, '$length_unit') >= $min_dist \n AND convert_km(distance::numeric, '$length_unit') / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 >= $min_speed \n AND ('${geofence:pipe}' = '-1' OR start_geofence.id in ($geofence) OR end_geofence.id in ($geofence)) \n ORDER BY start_date DESC\n)\nSELECT\n start_date_ts,\n end_date_ts,\n car_id,\n start_path,\n end_path,\n duration_str,\n drive_id,\n -- Columns\n start_date,\n start_address,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n start_battery_level as \"% Start\",\n end_battery_level as \"% End\",\n convert_celsius(outside_temp_avg, '$temp_unit') AS outside_temp_$temp_unit,\n convert_km(avg_speed::numeric, '$length_unit') AS speed_avg_$length_unit,\n convert_km(speed_max::numeric, '$length_unit') AS speed_max_$length_unit,\n power_max,\n reduced_range as has_reduced_range,\n CASE WHEN is_sufficiently_precise THEN distance / range_diff\n ELSE NULL\n END AS efficiency,\n range_diff * car_efficiency as \"consumption_kWh\",\n CASE WHEN is_sufficiently_precise THEN range_diff * car_efficiency / convert_km(distance::numeric, '$length_unit') * 1000\n END AS consumption_kWh_$length_unit\nFROM data\nWHERE\n start_address ILIKE '%$location%' OR end_address ILIKE '%$location%';",
"refId": "A",
"select": [
[
{
"params": [
"value"
],
"type": "column"
}
]
],
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Drive",
"type": "table"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 22
},
"id": 10,
"panels": [],
"title": "General information (All drives)",
"type": "row"
},
{
"fieldConfig": {
"defaults": {},
"overrides": []
},
"gridPos": {
"h": 2,
"w": 24,
"x": 0,
"y": 23
},
"id": 8,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
},
"content": "From here you can check if you have \nincomplete data of **Drives** (drives without ending date)\nIf so, you may follow the official \nguide by <a href='https://docs.teslamate.org/docs/maintenance/manually_fixing_data' target='_blank'>Manually fixing data</a>",
"mode": "markdown"
},
"pluginVersion": "11.5.2",
"title": "",
"type": "text"
},
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "fixed"
},
"custom": {
"align": "center",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"links": [],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 25
},
"id": 9,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"enablePagination": true,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "11.5.2",
"targets": [
{
"alias": "",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT id AS \"Drive ID\", start_date, end_date, distance, duration_min \nFROM drives \nWHERE car_id = $car_id AND end_date is null\nORDER BY start_date DESC",
"refId": "A",
"select": [
[
{
"params": [
"value"
],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Incomplete Drives 🛣️",
"type": "table"
}
],
"preload": false,
"refresh": "",
"schemaVersion": 40,
"tags": [
"tesla"
],
"templating": {
"list": [
{
"current": {},
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"includeAll": false,
"label": "Car",
"name": "car_id",
"options": [],
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"type": "query"
},
{
"allValue": "-1",
"current": {},
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT name AS __text, id AS __value FROM geofences ORDER BY name COLLATE \"C\" ASC;",
"description": "Start or Destination Geofence",
"includeAll": true,
"label": "Geofence",
"multi": true,
"name": "geofence",
"options": [],
"query": "SELECT name AS __text, id AS __value FROM geofences ORDER BY name COLLATE \"C\" ASC;",
"refresh": 1,
"regex": "",
"type": "query"
},
{
"current": {
"text": "",
"value": ""
},
"description": "Type a text contained in Start or Destination Location ",
"label": "Location",
"name": "location",
"options": [
{
"selected": true,
"text": "",
"value": ""
}
],
"query": "",
"type": "textbox"
},
{
"current": {},
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "select unit_of_temperature from settings limit 1;",
"hide": 2,
"includeAll": false,
"label": "temperature unit",
"name": "temp_unit",
"options": [],
"query": "select unit_of_temperature from settings limit 1;",
"refresh": 1,
"regex": "",
"type": "query"
},
{
"current": {},
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "select unit_of_length from settings limit 1;",
"hide": 2,
"includeAll": false,
"label": "length unit",
"name": "length_unit",
"options": [],
"query": "select unit_of_length from settings limit 1;",
"refresh": 1,
"regex": "",
"type": "query"
},
{
"current": {},
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "select preferred_range from settings limit 1;",
"hide": 2,
"includeAll": false,
"name": "preferred_range",
"options": [],
"query": "select preferred_range from settings limit 1;",
"refresh": 1,
"regex": "",
"type": "query"
},
{
"current": {},
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "select base_url from settings limit 1;",
"hide": 2,
"includeAll": false,
"name": "base_url",
"options": [],
"query": "select base_url from settings limit 1;",
"refresh": 1,
"regex": "",
"type": "query"
},
{
"current": {
"text": "0",
"value": "0"
},
"label": "Distance >=",
"name": "min_dist",
"options": [
{
"selected": true,
"text": "0",
"value": "0"
}
],
"query": "0",
"type": "textbox"
},
{
"current": {
"text": "0",
"value": "0"
},
"label": "Speed >=",
"name": "min_speed",
"options": [
{
"selected": true,
"text": "0",
"value": "0"
}
],
"query": "0",
"type": "textbox"
}
]
},
"time": {
"from": "now-3M",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Drives",
"uid": "Y8upc6ZRk",
"version": 1,
"weekStart": ""
}