Compare commits

...

2 commits

Author SHA1 Message Date
4199b067d1 Add Grafana dashboard 2024-10-11 22:06:52 +02:00
b0d063a235 📝 update Readme 2024-10-11 22:05:39 +02:00
2 changed files with 292 additions and 1 deletions

View file

@ -23,7 +23,7 @@ GND: GND
- Copy the `.env.example` to `/etc/powermeter-environment` and change it to your needs.
- Acivate at least InfluxDB (which I would recommend) or Flask output.
Clone this repository and create a virtualenv within it:
Clone this repository, configure `.env` file, setup systemd service:
```
git clone https://code.f2n.me/finn/powermeter.git

291
grafana.json Normal file
View file

@ -0,0 +1,291 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 13,
"links": [],
"panels": [
{
"datasource": {
"default": false,
"type": "influxdb",
"uid": "f110f59b-a1c0-4b41-ad7e-89f14edac426"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "watt"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 3,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.2.0",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "f110f59b-a1c0-4b41-ad7e-89f14edac426"
},
"query": "from(bucket: \"electricity\")\n |> range(start: -5m, stop: now())\n |> filter(fn: (r) => r[\"_measurement\"] == \"electricity\")\n |> filter(fn: (r) => r[\"_field\"] == \"consumption\")\n |> sum()\n |> map(fn: (r) => ({r with _value: float(v: r._value) * 12.0}))\n",
"refId": "A"
}
],
"title": "Current consumption",
"type": "stat"
},
{
"datasource": {
"default": false,
"type": "influxdb",
"uid": "f110f59b-a1c0-4b41-ad7e-89f14edac426"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 80,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "watt"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 2,
"options": {
"barRadius": 0,
"barWidth": 0.97,
"fullHighlight": false,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"orientation": "auto",
"showValue": "auto",
"stacking": "none",
"tooltip": {
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "f110f59b-a1c0-4b41-ad7e-89f14edac426"
},
"query": "from(bucket: \"electricity\")\n |> range(start: -7d, stop: now())\n |> filter(fn: (r) => r[\"_measurement\"] == \"electricity\")\n |> filter(fn: (r) => r[\"_field\"] == \"consumption\")\n |> aggregateWindow(every: 1d, fn: sum, createEmpty: false)\n",
"refId": "A"
}
],
"title": "Last 7 days",
"type": "barchart"
},
{
"datasource": {
"default": false,
"type": "influxdb",
"uid": "f110f59b-a1c0-4b41-ad7e-89f14edac426"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "smooth",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"id": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "11.2.0",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "f110f59b-a1c0-4b41-ad7e-89f14edac426"
},
"hide": false,
"query": "from(bucket: \"electricity\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"electricity\")\n |> filter(fn: (r) => r[\"_field\"] == \"consumption\")\n |> aggregateWindow(every: 5m, fn: sum, createEmpty: false)\n |> map(fn: (r) => ({r with _value: float(v: r._value) * 12.0}))\n",
"refId": "A"
}
],
"title": "5m average consumption",
"type": "timeseries"
}
],
"refresh": "1m",
"schemaVersion": 39,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "Electricity consumption",
"uid": "fdzs456q503r4f",
"version": 13,
"weekStart": ""
}