Skip to content

Instantly share code, notes, and snippets.

@bjarneeins
Last active June 7, 2021 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bjarneeins/076b874ef1027892d3b0bfa1df633fc5 to your computer and use it in GitHub Desktop.
Save bjarneeins/076b874ef1027892d3b0bfa1df633fc5 to your computer and use it in GitHub Desktop.
Example for a Grafana Dashboard which will display Information about Energy usage
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 1,
"links": [],
"panels": [
{
"datasource": "Steckdose",
"gridPos": {
"h": 5,
"w": 6,
"x": 0,
"y": 0
},
"id": 16,
"interval": "",
"options": {
"fieldOptions": {
"calcs": [
"last"
],
"defaults": {
"mappings": [],
"max": 3680,
"min": 0,
"thresholds": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 3000
}
],
"title": "",
"unit": "watt"
},
"override": {},
"values": false
},
"orientation": "auto",
"showThresholdLabels": false,
"showThresholdMarkers": false
},
"pluginVersion": "6.5.3",
"targets": [
{
"alias": "Leistung",
"groupBy": [
{
"params": [
"1s"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"power_mw"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Leistung",
"transparent": true,
"type": "gauge"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Steckdose",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 18,
"x": 6,
"y": 0
},
"hiddenSeries": false,
"id": 8,
"interval": "",
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "Leistung in Watt",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"power_mw"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
},
{
"alias": "Spannung in Volt",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"voltage_mv"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Leistung & Spannung",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"decimals": null,
"format": "short",
"label": "",
"logBase": 1,
"max": "600",
"min": "0",
"show": true
},
{
"decimals": null,
"format": "short",
"label": "",
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"cacheTimeout": null,
"datasource": "Steckdose",
"gridPos": {
"h": 5,
"w": 6,
"x": 0,
"y": 5
},
"id": 12,
"links": [],
"options": {
"fieldOptions": {
"calcs": [
"last"
],
"defaults": {
"mappings": [
{
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"max": 16,
"min": 0,
"nullValueMode": "connected",
"thresholds": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 8
}
],
"unit": "amp"
},
"override": {},
"values": false
},
"orientation": "horizontal",
"showThresholdLabels": false,
"showThresholdMarkers": false
},
"pluginVersion": "6.5.3",
"targets": [
{
"groupBy": [
{
"params": [
"1s"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"current_ma"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Stromstärke",
"transparent": true,
"type": "gauge"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Steckdose",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 18,
"x": 6,
"y": 7
},
"hiddenSeries": false,
"id": 6,
"interval": "",
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "Stromstärke in Ampere",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"current_ma"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Stromstärke",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"decimals": null,
"format": "short",
"label": "",
"logBase": 1,
"max": "6",
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"datasource": "Steckdose",
"gridPos": {
"h": 5,
"w": 6,
"x": 0,
"y": 10
},
"id": 14,
"options": {
"fieldOptions": {
"calcs": [
"last"
],
"defaults": {
"mappings": [],
"max": 230,
"min": 0,
"thresholds": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": ""
}
],
"unit": "volt"
},
"override": {},
"values": false
},
"orientation": "auto",
"showThresholdLabels": false,
"showThresholdMarkers": false
},
"pluginVersion": "6.5.3",
"targets": [
{
"groupBy": [
{
"params": [
"1s"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerData",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"voltage_mv"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Spannung",
"transparent": true,
"type": "gauge"
},
{
"aliasColors": {},
"bars": true,
"dashLength": 10,
"dashes": false,
"datasource": "Steckdose",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 9,
"x": 6,
"y": 14
},
"hiddenSeries": false,
"hideTimeOverride": false,
"id": 18,
"interval": "1h",
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": true,
"min": true,
"show": true,
"total": false,
"values": true
},
"lines": false,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "Verbrauch in Wh",
"groupBy": [
{
"params": [
"1h"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": "1d",
"timeRegions": [],
"timeShift": null,
"title": "Verbrauch pro Stunde",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": true,
"dashLength": 10,
"dashes": false,
"datasource": "Steckdose",
"decimals": 2,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 9,
"x": 15,
"y": 14
},
"hiddenSeries": false,
"hideTimeOverride": false,
"id": 20,
"interval": "1d",
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": true,
"min": true,
"show": true,
"total": false,
"values": true
},
"lines": false,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "Verbrauch in kWh",
"groupBy": [
{
"params": [
"1d"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"policy": "four_weeks",
"query": "SELECT count(distinct(\"total_wh\")) / 1000 FROM \"autogen\".\"PowerUsage\" WHERE $timeFilter GROUP BY time(1d) fill(none)",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": "7d",
"timeRegions": [],
"timeShift": null,
"title": "Verbrauch pro Tag",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"decimals": -1,
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorPostfix": false,
"colorPrefix": false,
"colorValue": true,
"colors": [
"#5794F2",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "Steckdose",
"decimals": 2,
"format": "kwatth",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 3,
"w": 3,
"x": 0,
"y": 15
},
"hideTimeOverride": true,
"id": 22,
"interval": "1d",
"links": [],
"mappingType": 2,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"pluginVersion": "6.5.3",
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false,
"ymax": null,
"ymin": null
},
"tableColumn": "",
"targets": [
{
"alias": "tagesverbrauch",
"groupBy": [
{
"params": [
"1d"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"panelId": 20,
"policy": "four_weeks",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
},
{
"params": [
" / 1000"
],
"type": "math"
}
]
],
"tags": [],
"tz": ""
}
],
"thresholds": "",
"timeFrom": "7d",
"timeShift": null,
"title": "Tagesverbrauch",
"type": "singlestat",
"valueFontSize": "110%",
"valueMaps": [],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorPostfix": false,
"colorPrefix": false,
"colorValue": true,
"colors": [
"#8F3BB8",
"rgba(237, 129, 40, 0.89)",
"rgb(110, 41, 115)"
],
"datasource": "Steckdose",
"decimals": 2,
"format": "currencyEUR",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 3,
"w": 3,
"x": 3,
"y": 15
},
"hideTimeOverride": true,
"id": 31,
"interval": "1d",
"links": [],
"mappingType": 2,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"pluginVersion": "6.5.3",
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false,
"ymax": null,
"ymin": null
},
"tableColumn": "",
"targets": [
{
"groupBy": [
{
"params": [
"1d"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"panelId": 20,
"policy": "four_weeks",
"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": ""
}
],
"thresholds": "",
"timeFrom": "1d",
"timeShift": null,
"title": "Tageskosten",
"type": "singlestat",
"valueFontSize": "110%",
"valueMaps": [],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorPostfix": false,
"colorPrefix": false,
"colorValue": true,
"colors": [
"#5794F2",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "Steckdose",
"decimals": 2,
"format": "kwatth",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 3,
"w": 4,
"x": 0,
"y": 18
},
"hideTimeOverride": true,
"id": 30,
"interval": "7d",
"links": [],
"mappingType": 2,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"pluginVersion": "6.5.3",
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false,
"ymax": null,
"ymin": null
},
"tableColumn": "",
"targets": [
{
"alias": "",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"panelId": 20,
"policy": "four_weeks",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"total_wh"
],
"type": "field"
},
{
"params": [],
"type": "distinct"
},
{
"params": [],
"type": "count"
},
{
"params": [
" / 1000 "
],
"type": "math"
}
]
],
"tags": [],
"tz": ""
}
],
"thresholds": "",
"timeFrom": "365d",
"timeShift": null,
"title": "Wochenverbrauch (zählt ab Donnerstag?!)",
"type": "singlestat",
"valueFontSize": "110%",
"valueMaps": [],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorPostfix": false,
"colorPrefix": false,
"colorValue": true,
"colors": [
"#8F3BB8",
"rgba(237, 129, 40, 0.89)",
"rgb(110, 41, 115)"
],
"datasource": "Steckdose",
"decimals": 2,
"format": "currencyEUR",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 3,
"w": 2,
"x": 4,
"y": 18
},
"hideTimeOverride": true,
"id": 28,
"interval": "1d",
"links": [],
"mappingType": 2,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"pluginVersion": "6.5.3",
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false,
"ymax": null,
"ymin": null
},
"tableColumn": "",
"targets": [
{
"groupBy": [
{
"params": [
"7d"
],
"type": "time"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "PowerUsage",
"orderByTime": "ASC",
"panelId": 20,
"policy": "four_weeks",
"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": ""
}
],
"thresholds": "",
"timeFrom": "7d",
"timeShift": null,
"title": "Kosten W",
"type": "singlestat",
"valueFontSize": "110%",
"valueMaps": [],
"valueName": "current"
}
],
"refresh": "5s",
"schemaVersion": 21,
"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",
"uid": "wJng_WUWk",
"version": 31
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment