Files
mg4/k8s/grafana/dashboards/charging.json
T
nilsandClaude Opus 5.5 5f6cf1e901 Revert "Grafana: line charts in MG red"
Back to Grafana's default palette for the line charts, as before.
This reverts commit c5d61d1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
2026-10-17 22:27:37 +02:00

518 lines
13 KiB
JSON

{
"uid": "mg4-charging",
"title": "MG4 - Charging",
"description": "DC charging sessions metered by the car. Prices in euro, as entered in the car's Charging tab.",
"tags": [
"mg4"
],
"timezone": "browser",
"editable": false,
"graphTooltip": 1,
"schemaVersion": 39,
"version": 1,
"time": {
"from": "now-90d",
"to": "now"
},
"refresh": "",
"templating": {
"list": [
{
"name": "installationId",
"label": "Car",
"type": "query",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"query": "import \"influxdata/influxdb/schema\"\nschema.tagValues(bucket: \"mg4\", tag: \"installationId\", start: -400d)",
"definition": "installationId tag values",
"refresh": 1,
"includeAll": false,
"multi": false,
"current": {},
"hide": 0,
"sort": 1
}
]
},
"annotations": {
"list": []
},
"panels": [
{
"id": 1,
"type": "stat",
"title": "DC sessions",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"gridPos": {
"x": 0,
"y": 0,
"w": 6,
"h": 4
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"query": "from(bucket: \"mg4\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"charging_session\" and r.installationId == \"${installationId}\" and r._field == \"energyKwh\")\n |> group()\n |> count()"
}
],
"fieldConfig": {
"defaults": {
"unit": "none",
"color": {
"mode": "fixed",
"fixedColor": "#E0424C"
},
"decimals": 0
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "value",
"graphMode": "none",
"textMode": "value"
}
},
{
"id": 2,
"type": "stat",
"title": "Drawn from grid",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"gridPos": {
"x": 6,
"y": 0,
"w": 6,
"h": 4
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"query": "from(bucket: \"mg4\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"charging_session\" and r.installationId == \"${installationId}\" and r._field == \"gridEnergyKwh\")\n |> group()\n |> sum()"
}
],
"fieldConfig": {
"defaults": {
"unit": "kwatth",
"color": {
"mode": "fixed",
"fixedColor": "#E0424C"
},
"decimals": 1
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "value",
"graphMode": "none",
"textMode": "value"
},
"description": "Net energy into the battery plus 10 % charging loss."
},
{
"id": 3,
"type": "stat",
"title": "Paid",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"gridPos": {
"x": 12,
"y": 0,
"w": 6,
"h": 4
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"query": "from(bucket: \"mg4\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"charging_session\" and r.installationId == \"${installationId}\" and r._field == \"totalCost\")\n |> group()\n |> sum()"
}
],
"fieldConfig": {
"defaults": {
"unit": "currencyEUR",
"color": {
"mode": "fixed",
"fixedColor": "#E0424C"
},
"decimals": 2
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "value",
"graphMode": "none",
"textMode": "value"
}
},
{
"id": 4,
"type": "stat",
"title": "Peak power",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"gridPos": {
"x": 18,
"y": 0,
"w": 6,
"h": 4
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"query": "from(bucket: \"mg4\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"charging_curve\" and r.installationId == \"${installationId}\" and r._field == \"powerKw\")\n |> group()\n |> max()\n |> keep(columns: [\"_value\"])"
}
],
"fieldConfig": {
"defaults": {
"unit": "kwatt",
"color": {
"mode": "fixed",
"fixedColor": "#E0424C"
},
"decimals": 0
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "value",
"graphMode": "none",
"textMode": "value"
}
},
{
"id": 5,
"type": "table",
"title": "Sessions",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"gridPos": {
"x": 0,
"y": 4,
"w": 24,
"h": 9
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"query": "from(bucket: \"mg4\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"charging_session\" and r.installationId == \"${installationId}\")\n |> pivot(rowKey: [\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")\n |> group()\n |> map(fn: (r) => ({r with gained: if exists r.endSocPercent and exists r.startSocPercent then r.endSocPercent - r.startSocPercent else 0.0}))\n |> keep(columns: [\"_time\", \"startSocPercent\", \"endSocPercent\", \"gained\", \"energyKwh\", \"gridEnergyKwh\", \"durationSeconds\", \"pricePerKwh\", \"totalCost\"])\n |> sort(columns: [\"_time\"], desc: true)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "_time"
},
"properties": [
{
"id": "displayName",
"value": "Start"
},
{
"id": "unit",
"value": "dateTimeAsIso"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "startSocPercent|endSocPercent|gained"
},
"properties": [
{
"id": "unit",
"value": "percent"
},
{
"id": "decimals",
"value": 0
}
]
},
{
"matcher": {
"id": "byName",
"options": "startSocPercent"
},
"properties": [
{
"id": "displayName",
"value": "SoC start"
}
]
},
{
"matcher": {
"id": "byName",
"options": "endSocPercent"
},
"properties": [
{
"id": "displayName",
"value": "SoC end"
}
]
},
{
"matcher": {
"id": "byName",
"options": "gained"
},
"properties": [
{
"id": "displayName",
"value": "Charge added"
}
]
},
{
"matcher": {
"id": "byName",
"options": "energyKwh"
},
"properties": [
{
"id": "displayName",
"value": "Net into battery"
},
{
"id": "unit",
"value": "kwatth"
},
{
"id": "decimals",
"value": 2
}
]
},
{
"matcher": {
"id": "byName",
"options": "gridEnergyKwh"
},
"properties": [
{
"id": "displayName",
"value": "From grid (+10%)"
},
{
"id": "unit",
"value": "kwatth"
},
{
"id": "decimals",
"value": 2
}
]
},
{
"matcher": {
"id": "byName",
"options": "durationSeconds"
},
"properties": [
{
"id": "displayName",
"value": "Duration"
},
{
"id": "unit",
"value": "dtdurations"
}
]
},
{
"matcher": {
"id": "byName",
"options": "pricePerKwh"
},
"properties": [
{
"id": "displayName",
"value": "Price"
},
{
"id": "unit",
"value": "currencyEUR"
},
{
"id": "decimals",
"value": 2
}
]
},
{
"matcher": {
"id": "byName",
"options": "totalCost"
},
"properties": [
{
"id": "displayName",
"value": "Cost"
},
{
"id": "unit",
"value": "currencyEUR"
},
{
"id": "decimals",
"value": 2
}
]
}
]
},
"options": {
"showHeader": true,
"cellHeight": "sm"
},
"transformations": [
{
"id": "organize",
"options": {
"indexByName": {
"_time": 0,
"durationSeconds": 1,
"startSocPercent": 2,
"endSocPercent": 3,
"gained": 4,
"energyKwh": 5,
"gridEnergyKwh": 6,
"pricePerKwh": 7,
"totalCost": 8
}
}
}
]
},
{
"id": 6,
"type": "timeseries",
"title": "Charging curves",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"gridPos": {
"x": 0,
"y": 13,
"w": 24,
"h": 9
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "influxdb",
"uid": "mg4-influxdb"
},
"query": "from(bucket: \"mg4\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"charging_curve\" and r.installationId == \"${installationId}\" and (r._field == \"powerKw\" or r._field == \"socPercent\"))\n |> group(columns: [\"_field\"])\n |> keep(columns: [\"_time\", \"_field\", \"_value\"])\n |> sort(columns: [\"_time\"])"
}
],
"fieldConfig": {
"defaults": {
"unit": "kwatt",
"custom": {
"lineWidth": 2,
"fillOpacity": 8,
"spanNulls": 600000,
"showPoints": "never"
}
},
"overrides": [
{
"matcher": {
"id": "byRegexp",
"options": ".*socPercent.*"
},
"properties": [
{
"id": "unit",
"value": "percent"
},
{
"id": "custom.axisPlacement",
"value": "right"
}
]
}
]
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi"
}
},
"description": "Only DC charges above 10 kW are metered. Pick a time range around a session to see its curve."
}
]
}