Files
archived-hipudding-teslamate/grafana/dashboards/charging-stats.json
nicoladefranceschi 393d543950 Update charging-stats.json (#2656)
Fix query for Charging Stats -> Charge Delta
2022-06-24 13:47:10 +02:00

1820 lines
46 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"annotations": {
"list": [
{
"$$hashKey": "object:75",
"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": 1,
"iteration": 1650630830781,
"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": [
{
"collapsed": false,
"datasource": "TeslaMate",
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 12,
"panels": [],
"repeat": "car_id",
"title": "$car_id",
"type": "row"
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#c7d0d9",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 0,
"y": 1
},
"id": 8,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"fieldOptions": {
"calcs": [
"mean"
]
},
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "value"
},
"pluginVersion": "8.4.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\tcount(*)\nFROM\n\tcharging_processes\nWHERE\n\t$__timeFilter(end_date)\n\tAND charge_energy_added > 0.01\n\tAND car_id = $car_id;",
"refId": "A",
"select": [
[
{
"params": [
"efficiency"
],
"type": "column"
}
]
],
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Number of Charges",
"type": "stat"
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#c7d0d9",
"value": null
}
]
},
"unit": "kwatth"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 6,
"y": 1
},
"id": 10,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"fieldOptions": {
"calcs": [
"mean"
]
},
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "value"
},
"pluginVersion": "8.4.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\tsum(charge_energy_added)\nFROM\n\tcharging_processes\nWHERE\n\t$__timeFilter(end_date)\n\tAND car_id = $car_id;\n",
"refId": "A",
"select": [
[
{
"params": [
"efficiency"
],
"type": "column"
}
]
],
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Charged in total",
"type": "stat"
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#c7d0d9",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 4,
"x": 12,
"y": 1
},
"id": 14,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"fieldOptions": {
"calcs": [
"mean"
]
},
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "value"
},
"pluginVersion": "8.4.5",
"targets": [
{
"datasource": "TeslaMate",
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\tsum(cp.cost)\nFROM\n\tcharging_processes cp\nLEFT JOIN \n\taddresses addr ON addr.id = address_id\nWHERE\n $__timeFilter(end_date)\n AND addr.name LIKE '%Supercharger%'\n\tAND cp.cost IS NOT NULL\n\tAND cp.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": "Charging Cost at SuC",
"type": "stat"
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#c7d0d9",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 4,
"x": 16,
"y": 1
},
"id": 27,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"fieldOptions": {
"calcs": [
"mean"
]
},
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "value"
},
"pluginVersion": "8.4.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\tsum(cost)\nFROM\n\tcharging_processes\nWHERE\n\t$__timeFilter(end_date)\n\tAND 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": "Total Charging Cost",
"type": "stat"
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"decimals": 2,
"displayName": "",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#d8d9da",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 4,
"x": 20,
"y": 1
},
"id": 26,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "8.4.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT (\n SELECT sum(cost)\n FROM charging_processes\n WHERE $__timeFilter(end_date) AND car_id = $car_id\n) / (\n\tSELECT convert_km((max(odometer) - min(odometer))::numeric, '$length_unit')\n\tFROM positions\n\tWHERE $__timeFilter(date) AND car_id = $car_id\n) * 100",
"refId": "A",
"select": [
[
{
"params": [
"efficiency"
],
"type": "column"
}
]
],
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Cost per 100 $length_unit",
"type": "stat"
},
{
"cards": {},
"color": {
"cardColor": "#b4ff00",
"colorScale": "linear",
"colorScheme": "interpolateGreens",
"exponent": 0.5,
"min": 0,
"mode": "opacity"
},
"dataFormat": "timeseries",
"datasource": "TeslaMate",
"gridPos": {
"h": 6,
"w": 12,
"x": 0,
"y": 4
},
"heatmap": {},
"hideZeroBuckets": false,
"highlightCards": true,
"id": 15,
"legend": {
"show": false
},
"reverseYBuckets": false,
"targets": [
{
"format": "time_series",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\t$__time(start_date),\n\tstart_battery_level,\n\tend_battery_level\nFROM\n\tcharging_processes\nWHERE\n\t$__timeFilter(start_date)\n\tAND duration_min > 3\n\tAND car_id = $car_id\nORDER BY\n\tstart_date;",
"refId": "A",
"select": [
[
{
"params": [
"charge_energy_added"
],
"type": "column"
}
]
],
"table": "charges",
"timeColumn": "date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"timeFrom": "6M",
"title": "Charge Heatmap",
"tooltip": {
"show": true,
"showHistogram": false
},
"type": "heatmap",
"xAxis": {
"show": true
},
"yAxis": {
"format": "short",
"logBase": 1,
"max": "100",
"show": true
},
"yBucketBound": "auto",
"yBucketSize": 10.00001
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "TeslaMate",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 6,
"w": 12,
"x": 12,
"y": 4
},
"hiddenSeries": false,
"id": 16,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": false,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.4.5",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "end_battery_level",
"color": "#73BF69",
"fillBelowTo": "start_battery_level",
"lines": false
},
{
"alias": "start_battery_level",
"lines": false
}
],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"format": "time_series",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "WITH charges AS (\n\tSELECT\n\t\tstart_date,\n\t\tstart_battery_level,\n\t\tend_battery_level,\n\t\tp.odometer,\n\t\tCOALESCE(\n\t\t\tLAG(p.odometer) OVER (\n\t\t\t\tORDER BY cp.start_date\n\t\t\t),\n\t\t\tp.odometer\n\t\t) as odometer_prev\n\tFROM\n\t\tcharging_processes cp\n\tJOIN positions p\n\tON p.id = cp.position_id\n\tWHERE\n\t\t$__timeFilter(cp.start_date)\n\t\tAND cp.duration_min > 3\n\t\tAND cp.car_id = $car_id\n)\nSELECT\n\tMIN(start_date) as time,\n\tMIN(start_battery_level) as start_battery_level,\n\tMAX(end_battery_level) as end_battery_level\nFROM charges\nGROUP BY\n\tCASE WHEN odometer - odometer_prev < 2 THEN odometer_prev ELSE odometer END\nORDER BY\n\ttime;",
"refId": "A",
"select": [
[
{
"params": [
"charge_energy_added"
],
"type": "column"
}
]
],
"table": "charges",
"timeColumn": "date",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"thresholds": [
{
"colorMode": "ok",
"fill": false,
"line": true,
"op": "gt",
"value": 80,
"yaxis": "left"
},
{
"colorMode": "ok",
"fill": false,
"line": true,
"op": "lt",
"value": 20,
"yaxis": "left"
}
],
"timeFrom": "6M",
"timeRegions": [],
"title": "Charge Delta",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"logBase": 1,
"max": "100",
"min": "0",
"show": true
},
{
"format": "short",
"logBase": 1,
"show": false
}
],
"yaxis": {
"align": false
}
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"decimals": 0,
"mappings": [],
"unit": "kwatth"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "AC"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#73BF69",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "DC"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#FADE2A",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 13,
"w": 5,
"x": 0,
"y": 10
},
"id": 18,
"links": [],
"maxDataPoints": 3,
"options": {
"displayLabels": [
"name"
],
"legend": {
"calcs": [],
"displayMode": "table",
"placement": "bottom",
"values": [
"value",
"percent"
]
},
"pieType": "pie",
"reduceOptions": {
"calcs": [
"sum"
],
"fields": "",
"values": false
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"format": "time_series",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "WITH data AS (\n SELECT\n\t\tcp.id,\n\t\tcp.charge_energy_added,\n\t\tCASE WHEN NULLIF(mode() within group (order by charger_phases),0) is null THEN 'DC'\n\t\t\t\t ELSE 'AC'\n\t\tEND AS current\n\tFROM charging_processes cp\n RIGHT JOIN charges ON cp.id = charges.charging_process_id\n WHERE\n\t cp.car_id = $car_id\n\t AND cp.charge_energy_added > 0.01\n\t AND $__timeFilter(start_date)\n GROUP BY 1,2\n)\nSELECT\n\tnow() AS time,\n\tsum(charge_energy_added) AS value,\n\tcurrent AS metric\nFROM data\nGROUP BY 3\nORDER BY metric DESC;",
"refId": "A",
"select": [
[
{
"params": [
"latitude"
],
"type": "column"
}
]
],
"table": "addresses",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "AC/DC kWh",
"type": "piechart"
},
{
"autoPanLabels": true,
"autoWidthLabels": true,
"categories": "a,b",
"circleMaxSize": 30,
"circleMinSize": 2,
"circleOptions": {
"strokeEnabled": false,
"strokeWeight": "2"
},
"circleSizeAbsoluteEnabled": false,
"circleSizeAbsoluteFactor": 1,
"clickthroughOptions": {},
"clickthroughUrl": "",
"colorMode": "threshold",
"colors": [
"#f53636",
"#c05634",
"#976f32",
"#688b30",
"#32ac2d"
],
"customAttribution": false,
"datasource": "TeslaMate",
"decimals": 2,
"description": "",
"doubleClickZoom": true,
"dragging": true,
"enableOverlay": false,
"enableReloadOverlay": false,
"esMetric": "Count",
"formatOmitEmptyValue": false,
"gridPos": {
"h": 13,
"w": 14,
"x": 5,
"y": 10
},
"hideEmpty": false,
"hideTimepickerNavigation": false,
"hideZero": false,
"id": 24,
"ignoreEmptyGeohashValues": false,
"ignoreEscapeKey": false,
"ignoreInvalidGeohashValues": false,
"initialZoom": 1,
"locationData": "table",
"mapCenter": "(0°, 0°)",
"mapCenterLatitude": 0,
"mapCenterLongitude": 0,
"mapFitData": true,
"maxDataPoints": 1,
"mouseWheelZoom": true,
"overlayOpacity": 0.5,
"overlayRangeLatitude": "0,10",
"overlayRangeLongitude": "0,20",
"overlayUrl": "",
"showAttribution": false,
"showLegend": true,
"showZoomControl": true,
"stickyLabels": false,
"tableQueryOptions": {
"geohashField": "geohash",
"labelField": "loc_nm",
"latitudeField": "lat",
"longitudeField": "lng",
"metricField": "pct",
"queryType": "coordinates"
},
"targets": [
{
"datasource": "TeslaMate",
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "WITH charge_data AS (\r\nSELECT COALESCE(geofence.name, CONCAT_WS(', ', COALESCE(address.name, nullif(CONCAT_WS(' ', address.road, address.house_number), '')), address.city)) AS loc_nm\r\n, AVG(position.latitude) AS lat \r\n, AVG(position.longitude) AS lng\r\n,sum(charge.charge_energy_added) AS chg_total\r\nFROM charging_processes charge\r\nLEFT JOIN addresses address ON charge.address_id = address.id\r\nLEFT JOIN positions position ON charge.position_id = position.id\r\nLEFT JOIN geofences geofence ON charge.geofence_id = geofence.id\r\nWHERE $__timeFilter(charge.start_date) \r\nAND charge.car_id = $car_id\r\nGROUP BY COALESCE(geofence.name, CONCAT_WS(', ', COALESCE(address.name, nullif(CONCAT_WS(' ', address.road, address.house_number), '')), address.city))\r\n) \r\nSELECT loc_nm\r\n\t,lat\r\n\t,lng\r\n\t,chg_total\r\n\t,chg_total * 1.0 / (SELECT sum(chg_total) FROM charge_data) * 100 AS pct\r\nFROM charge_data",
"refId": "A",
"select": [
[
{
"params": [
"efficiency"
],
"type": "column"
}
]
],
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"thresholds": "0,25,50,75",
"title": "Charging heat map by kWh",
"type": "panodata-map-panel",
"unitPlural": "%",
"unitSingular": "%",
"valueName": "total"
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"decimals": 1,
"mappings": [],
"unit": "dtdurations"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "AC"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#73BF69",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "DC"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#FADE2A",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 13,
"w": 5,
"x": 19,
"y": 10
},
"id": 20,
"links": [],
"maxDataPoints": 3,
"options": {
"displayLabels": [
"name"
],
"legend": {
"calcs": [],
"displayMode": "table",
"placement": "bottom",
"values": [
"value",
"percent"
]
},
"pieType": "pie",
"reduceOptions": {
"calcs": [
"sum"
],
"fields": "",
"values": false
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"format": "time_series",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "WITH data AS (\n SELECT\n\t\tcp.id,\n\t\tcp.duration_min,\n\t\tCASE WHEN NULLIF(mode() within group (order by charger_phases),0) is null THEN 'DC'\n\t\t\t\t ELSE 'AC'\n\t\tEND AS current\n\tFROM charging_processes cp\n RIGHT JOIN charges ON cp.id = charges.charging_process_id\n WHERE\n\t cp.car_id = $car_id\n\t AND cp.charge_energy_added > 0.01\n\t AND $__timeFilter(start_date)\n GROUP BY 1,2\n)\nSELECT\n\tnow() AS time,\n\tsum(duration_min) * 60 AS value,\n\tcurrent AS metric\nFROM data\nGROUP BY 3\nORDER BY metric DESC;",
"refId": "A",
"select": [
[
{
"params": [
"latitude"
],
"type": "column"
}
]
],
"table": "addresses",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "AC/DC Duration",
"type": "piechart"
},
{
"datasource": "TeslaMate",
"gridPos": {
"h": 16,
"w": 24,
"x": 0,
"y": 23
},
"id": 29,
"links": [],
"pconfig": {
"fixScale": "",
"layout": {
"dragmode": "zoom",
"font": {
"family": "\"Open Sans\", Helvetica, Arial, sans-serif"
},
"hovermode": "closest",
"legend": {
"orientation": "h"
},
"showlegend": false,
"xaxis": {
"rangemode": "normal",
"showgrid": true,
"title": "SOC [%]",
"type": "linear",
"zeroline": false
},
"yaxis": {
"rangemode": "tozero",
"showgrid": true,
"title": "kW",
"type": "linear",
"zeroline": false
},
"zaxis": {
"rangemode": "normal",
"showgrid": true,
"type": "linear",
"zeroline": false
}
},
"loadFromCDN": false,
"settings": {
"displayModeBar": false,
"type": "scatter"
},
"showAnnotations": true,
"traces": [
{
"mapping": {
"color": "charging_process_id",
"text": "Charge",
"x": "SOC [%]",
"y": "Power [kW]"
},
"name": "Charge Curve",
"settings": {
"color_option": "ramp",
"line": {
"color": "#005f81",
"dash": "solid",
"shape": "linear",
"width": 6
},
"marker": {
"color": "#33B5E5",
"colorscale": "Reds",
"line": {
"color": "#DDD",
"width": 0
},
"showscale": false,
"size": 3,
"sizemin": 3,
"sizemode": "diameter",
"sizeref": 0.2,
"symbol": "circle"
}
},
"show": {
"line": true,
"lines": false,
"markers": true
}
},
{
"mapping": {
"color": "charging_process_id",
"x": "B - SOC [%]",
"y": "B - Avg Power [kW]"
},
"name": "Median Power",
"settings": {
"color_option": "solid",
"line": {
"color": "#FF7383",
"dash": "solid",
"shape": "linear",
"width": 2
},
"marker": {
"color": "#33B5E5",
"colorscale": "Reds",
"line": {
"color": "#DDD",
"width": 0
},
"showscale": false,
"size": 2,
"sizemin": 3,
"sizemode": "diameter",
"sizeref": 0.2,
"symbol": "circle"
}
},
"show": {
"line": true,
"lines": true,
"markers": false
}
}
]
},
"pluginVersion": "7.5.11",
"targets": [
{
"alias": "",
"datasource": "TeslaMate",
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\r\n c.battery_level as \"SOC [%]\",\r\n round(avg(c.charger_power), 0) as \"Power [kW]\",\r\n c.charging_process_id as \"charging_process_id\",\r\n COALESCE(g.name, a.name) || ' ' || to_char(c.date, 'YYYY-MM-dd') as \"Charge\"\r\nFROM\r\n charges c\r\nJOIN charging_processes p ON p.id = c.charging_process_id \r\nJOIN addresses a ON a.id = p.address_id\r\nLEFT JOIN geofences g ON g.id = p.geofence_id\r\nWHERE\r\n $__timeFilter(date)\r\n AND p.car_id = $car_id\r\n AND charger_power > 0\r\n AND c.fast_charger_present\r\nGROUP BY c.battery_level, c.charging_process_id, a.name, g.name, to_char(c.date, 'YYYY-MM-dd')",
"refId": "A",
"select": [
[
{
"params": [
"value"
],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
},
{
"datasource": "TeslaMate",
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n c.battery_level as \"B - SOC [%]\",\n PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY charger_power) as \"B - Avg Power [kW]\"\nFROM\n charges c\njoin\n charging_processes p ON p.id = c.charging_process_id \nWHERE\n $__timeFilter(date)\n AND p.car_id = $car_id\n AND charger_power > 0\n AND c.fast_charger_present\nGROUP BY battery_level",
"refId": "B",
"select": [
[
{
"params": [
"efficiency"
],
"type": "column"
}
]
],
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "DC Charging Curve",
"type": "natel-plotly-panel",
"version": 1
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"displayMode": "auto"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "soc"
},
"properties": [
{
"id": "custom.width",
"value": 70
},
{
"id": "displayName",
"value": "SOC"
},
{
"id": "custom.displayMode",
"value": "color-text"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "yellow",
"value": 80
},
{
"color": "red",
"value": 91
}
]
}
},
{
"id": "unit",
"value": "percent"
}
]
},
{
"matcher": {
"id": "byName",
"options": "n"
},
"properties": [
{
"id": "displayName",
"value": "# of Charges"
},
{
"id": "custom.displayMode",
"value": "gradient-gauge"
},
{
"id": "max"
},
{
"id": "min",
"value": 0
}
]
}
]
},
"gridPos": {
"h": 18,
"w": 3,
"x": 0,
"y": 39
},
"id": 2,
"links": [],
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": []
},
"pluginVersion": "8.4.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\tROUND(end_battery_level / 5, 0) * 5 AS SOC,\n\tcount(*) AS n\nFROM\n\tcharging_processes\nWHERE\n\t$__timeFilter(end_date)\n\tAND duration_min > 3\n\tAND car_id = $car_id\nGROUP BY\n\tROUND(end_battery_level / 5, 0) * 5\nORDER BY\n\tSOC DESC",
"refId": "A",
"select": [
[
{
"params": [
"value"
],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Charge Stats",
"type": "table"
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"displayMode": "auto"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "soc"
},
"properties": [
{
"id": "displayName",
"value": "SOC"
},
{
"id": "unit",
"value": "percent"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "#EAB839",
"value": 10
},
{
"color": "green",
"value": 20
}
]
}
},
{
"id": "custom.displayMode",
"value": "color-text"
},
{
"id": "custom.width",
"value": 70
}
]
},
{
"matcher": {
"id": "byName",
"options": "n"
},
"properties": [
{
"id": "displayName",
"value": "# of Discharges"
},
{
"id": "custom.displayMode",
"value": "gradient-gauge"
},
{
"id": "min",
"value": 0
}
]
}
]
},
"gridPos": {
"h": 18,
"w": 3,
"x": 3,
"y": 39
},
"id": 13,
"links": [],
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": []
},
"pluginVersion": "8.4.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\tROUND(start_battery_level / 5, 0) * 5 AS SOC,\n\tcount(*) AS n\nFROM\n\tcharging_processes\nWHERE\n\t$__timeFilter(end_date)\n\tAND duration_min > 3\n\tAND car_id = $car_id\nGROUP BY\n 1\nORDER BY\n\tSOC DESC",
"refId": "A",
"select": [
[
{
"params": [
"value"
],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Discharge Stats",
"type": "table"
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"displayMode": "auto"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "location"
},
"properties": [
{
"id": "displayName",
"value": "Location"
}
]
},
{
"matcher": {
"id": "byName",
"options": "charge_energy_added"
},
"properties": [
{
"id": "displayName",
"value": "Charged"
},
{
"id": "custom.width",
"value": 120
},
{
"id": "custom.align",
"value": "left"
}
]
}
]
},
"gridPos": {
"h": 18,
"w": 9,
"x": 6,
"y": 39
},
"id": 4,
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "8.4.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\tCOALESCE(geofence.name, CONCAT_WS(', ', COALESCE(address.name, nullif(CONCAT_WS(' ', address.road, address.house_number), '')), address.city)) AS location,\n\tCASE\n WHEN SUM(charge_energy_added) < 1000 THEN SUM(charge_energy_added)::NUMERIC(4,0)::VARCHAR || ' kWh' \n WHEN SUM(charge_energy_added) < 1000000 THEN (SUM(charge_energy_added) / 1000)::NUMERIC(9, 3)::VARCHAR || ' MWh' \n WHEN SUM(charge_energy_added) >= 1000000 THEN (SUM(charge_energy_added) / 1000000)::NUMERIC(9, 3)::VARCHAR || ' GWh' \n END as charge_energy_added\nFROM\n\tcharging_processes c\nLEFT JOIN addresses address ON c.address_id = address.id\nLEFT JOIN geofences geofence ON geofence_id = geofence.id\nWHERE\n\t$__timeFilter(end_date)\n\tAND car_id = $car_id\nGROUP BY\n\t1\nORDER BY\n\tSUM(charge_energy_added) DESC\nLIMIT 17;",
"refId": "A",
"select": [
[
{
"params": [
"value"
],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Top Charging Stations (Charged)",
"type": "table"
},
{
"datasource": "TeslaMate",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"displayMode": "auto"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "location"
},
"properties": [
{
"id": "displayName",
"value": "Location"
}
]
},
{
"matcher": {
"id": "byName",
"options": "cost"
},
"properties": [
{
"id": "displayName",
"value": "Cost"
},
{
"id": "custom.width",
"value": 120
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.align",
"value": "left"
}
]
}
]
},
"gridPos": {
"h": 18,
"w": 9,
"x": 15,
"y": 39
},
"id": 6,
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "8.4.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\tCOALESCE(geofence.name, CONCAT_WS(', ', COALESCE(address.name, CONCAT_WS(' ', address.road, address.house_number)), address.city)) AS location,\n\tsum(cost) as cost\nFROM\n\tcharging_processes c\n\tLEFT JOIN addresses address ON c.address_id = address.id\n\tLEFT JOIN geofences geofence ON geofence_id = geofence.id\nWHERE\n $__timeFilter(end_date) AND\n\tcar_id = $car_id AND\n\tCOST IS NOT NULL\nGROUP BY\n\t1\nORDER BY\n\t2 DESC NULLS LAST\nLIMIT 17;",
"refId": "A",
"select": [
[
{
"params": [
"efficiency"
],
"type": "column"
}
]
],
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Top Charging Stations (Cost)",
"type": "table"
}
],
"refresh": false,
"schemaVersion": 35,
"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
},
{
"current": {
"selected": false,
"text": "km",
"value": "km"
},
"datasource": "TeslaMate",
"definition": "select unit_of_length from settings limit 1;",
"hide": 2,
"includeAll": false,
"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
}
]
},
"time": {
"from": "now-10y",
"to": "now"
},
"timepicker": {
"hidden": false,
"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": "Charging Stats",
"uid": "-pkIkhmRz",
"version": 1,
"weekStart": ""
}