Skip to content

Instantly share code, notes, and snippets.

@bjarneeins
Last active November 13, 2022 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjarneeins/bdf43ac3eb988ec05a432487c2c2efe6 to your computer and use it in GitHub Desktop.
Save bjarneeins/bdf43ac3eb988ec05a432487c2c2efe6 to your computer and use it in GitHub Desktop.
Example for a Grafana Dashboard which will display Information about Energy usage (using Flux queries prepared for InfluxDB2.0)
{
"__inputs": [
{
"name": "DS_INFLUXDB2.0",
"label": "InfluxDB2.0",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
],
"__elements": {},
"__requires": [
{
"type": "panel",
"id": "gauge",
"name": "Gauge",
"version": ""
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "9.1.8"
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "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,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"displayName": "",
"mappings": [],
"max": 3680,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 3000
}
]
},
"unit": "watt"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 6,
"x": 0,
"y": 0
},
"id": 16,
"interval": "",
"options": {
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": false
},
"pluginVersion": "9.1.8",
"targets": [
{
"alias": "Leistung",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"1s"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"dosedata\")\n |> range(start: -1m)\n |> filter(fn: (r) => r._measurement == \"PowerData\" and r._field == \"power_mw\")\n |> group()\n |> last() \n |> map(fn: (r) => ({r with _value: r._value / 1000}))",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"power_mw"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"title": "Leistung",
"transparent": true,
"type": "gauge"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"links": [],
"mappings": [],
"max": 600,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "power_mw"
},
"properties": [
{
"id": "displayName",
"value": "Leistung in Watt"
}
]
},
{
"matcher": {
"id": "byName",
"options": "voltage_mv"
},
"properties": [
{
"id": "displayName",
"value": "Spannung in Volt"
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 18,
"x": 6,
"y": 0
},
"id": 8,
"interval": "",
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max",
"min"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "9.1.8",
"targets": [
{
"alias": "Leistung in Watt",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"dosedata\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"PowerData\" and r._field == \"power_mw\")\n |> map(fn: (r) => ({r with _value: r._value / 1000}))\n\n",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"power_mw"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
},
{
"alias": "Spannung in Volt",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"dosedata\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"PowerData\" and r._field == \"voltage_mv\")\n |> map(fn: (r) => ({r with _value: r._value / 1000}))",
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"voltage_mv"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"title": "Leistung & Spannung",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"max": 16,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 8
}
]
},
"unit": "amp"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 6,
"x": 0,
"y": 5
},
"id": 12,
"links": [],
"options": {
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"last"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": false
},
"pluginVersion": "9.1.8",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"1s"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"dosedata\")\n |> range(start: -1m)\n |> filter(fn: (r) => r._measurement == \"PowerData\" and r._field == \"current_ma\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"current_ma"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"title": "Stromstärke",
"transformations": [
{
"id": "calculateField",
"options": {
"binary": {
"left": "current_ma",
"operator": "/",
"reducer": "sum",
"right": "1000"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"replaceFields": true
}
}
],
"transparent": true,
"type": "gauge"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"displayName": "Stromstärke in Ampere",
"links": [],
"mappings": [],
"max": 6,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "amp"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 18,
"x": 6,
"y": 7
},
"id": 6,
"interval": "",
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max",
"min"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "9.1.8",
"targets": [
{
"alias": "Stromstärke in Ampere",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"dosedata\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"PowerData\" and r._field == \"current_ma\")\n",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"current_ma"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"title": "Stromstärke",
"transformations": [
{
"id": "calculateField",
"options": {
"binary": {
"left": "current_ma",
"operator": "/",
"reducer": "sum",
"right": "1000"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"replaceFields": true
}
}
],
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"max": 230,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": ""
}
]
},
"unit": "volt"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 6,
"x": 0,
"y": 10
},
"id": 14,
"options": {
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": false
},
"pluginVersion": "9.1.8",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"1s"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"dosedata\")\n |> range(start: -1m)\n |> filter(fn: (r) => r._measurement == \"PowerData\" and r._field == \"voltage_mv\")\n |> group()\n |> last() \n |> map(fn: (r) => ({r with _value: r._value / 1000}))",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"voltage_mv"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"title": "Spannung",
"transparent": true,
"type": "gauge"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "bars",
"fillOpacity": 100,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 8,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"displayName": "Verbrauch in Wh",
"links": [],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "watth"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 9,
"x": 6,
"y": 14
},
"hideTimeOverride": false,
"id": 18,
"interval": "1h",
"options": {
"legend": {
"calcs": [
"lastNotNull",
"max",
"min"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "asc"
}
},
"pluginVersion": "9.1.8",
"targets": [
{
"alias": "Verbrauch in Wh",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"1h"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"dosedata\")\n |> range(start: -24h)\n |> filter(fn: (r) => r._measurement == \"PowerUsage\" and r._field == \"total_wh\")\n |> aggregateWindow(every: 1h, fn:last)\n |> difference()\n\n\n",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
}
]
],
"tags": []
}
],
"timeFrom": "1d",
"title": "Verbrauch pro Stunde",
"transformations": [],
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "bars",
"fillOpacity": 100,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 8,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"displayName": "Verbrauch in kWh",
"links": [],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "watth"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 9,
"x": 15,
"y": 14
},
"hideTimeOverride": false,
"id": 20,
"interval": "1d",
"options": {
"legend": {
"calcs": [
"lastNotNull",
"max",
"min"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "9.1.8",
"targets": [
{
"alias": "Verbrauch in kWh",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"1d"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"policy": "four_weeks",
"query": "from(bucket: \"dosedata\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"PowerUsage\" and r._field == \"total_wh\")\n |> aggregateWindow(every: 1d, fn: last)\n |> difference()",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"timeFrom": "7d",
"title": "Verbrauch pro Tag",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "watth"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 0,
"y": 15
},
"hideTimeOverride": true,
"id": 22,
"interval": "1d",
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.1.8",
"targets": [
{
"alias": "tagesverbrauch",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"1d"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"panelId": 20,
"policy": "four_weeks",
"query": "from(bucket: \"dosedata\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"PowerUsage\" and r._field == \"total_wh\")\n |> aggregateWindow(every: 1d, fn:last)\n |> difference()",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": [],
"tz": ""
}
],
"timeFrom": "7d",
"title": "Tagesverbrauch",
"type": "stat"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "currencyEUR"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 3,
"y": 15
},
"hideTimeOverride": true,
"id": 31,
"interval": "1d",
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.1.8",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"1d"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"panelId": 20,
"policy": "four_weeks",
"query": "from(bucket: \"dosedata\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"PowerUsage\" and r._field == \"total_wh\")\n |> map(fn: (r) => ({r with _value: float(v: r._value) / 1000.0 * 0.35}))\n |> aggregateWindow(every: 1d, fn:last)\n |> difference()",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
},
{
"params": [
" / 1000 * 0.35"
],
"type": "math"
}
]
],
"tags": [],
"tz": ""
}
],
"timeFrom": "1d",
"title": "Tageskosten",
"transformations": [],
"type": "stat"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "watth"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 0,
"y": 18
},
"hideTimeOverride": true,
"id": 30,
"interval": "7d",
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.1.8",
"targets": [
{
"alias": "",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"panelId": 20,
"policy": "four_weeks",
"query": "from(bucket: \"dosedata\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"PowerUsage\" and r._field == \"total_wh\")\n |> aggregateWindow(every: 1w, fn:last)\n |> difference()",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
},
{
"params": [
" / 1000 "
],
"type": "math"
}
]
],
"tags": [],
"tz": ""
}
],
"timeFrom": "365d",
"title": "Wochenverbrauch ",
"type": "stat"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "currencyEUR"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 3,
"y": 18
},
"hideTimeOverride": true,
"id": 28,
"interval": "1d",
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.1.8",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB2.0}"
},
"groupBy": [
{
"params": [
"7d"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"panelId": 20,
"policy": "four_weeks",
"query": "from(bucket: \"dosedata\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"PowerUsage\" and r._field == \"total_wh\")\n |> map(fn: (r) => ({r with _value: float(v: r._value) / 1000.0 * 0.35}))\n |> aggregateWindow(every: 1w, fn:last)\n |> difference()",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
},
{
"params": [
" / 1000 * 0.35"
],
"type": "math"
}
]
],
"tags": [],
"tz": ""
}
],
"timeFrom": "7d",
"title": "Wochenkosten",
"transformations": [],
"type": "stat"
}
],
"refresh": "5s",
"schemaVersion": 37,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Steckdosen-Daten InfluxDB2.0",
"uid": "dPdlQaI4z",
"version": 35,
"weekStart": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment