diff --git a/grafana/P1-Messdaten.json b/grafana/P1-Messdaten.json new file mode 100644 index 0000000..be45670 --- /dev/null +++ b/grafana/P1-Messdaten.json @@ -0,0 +1,902 @@ +{ + "__inputs": [ + { + "name": "DS_P1", + "label": "p1", + "description": "", + "type": "datasource", + "pluginId": "grafana-postgresql-datasource", + "pluginName": "PostgreSQL" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "11.1.1" + }, + { + "type": "datasource", + "id": "grafana-postgresql-datasource", + "name": "PostgreSQL", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], + "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": null, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "watt" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 8, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean", + "stdDev", + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "-- SELECT time_bucket('$__interval', timestamp) AS time, \n-- delivery_l1 - returning_l1 AS \"Vermogen L1\", \n-- delivery_l2 - returning_l2 AS \"Vermogen L2\", \n-- delivery_l3 - returning_l3 AS \"Vermogen L3\",\n-- delivery_all - returning_all AS \"Vermogen totaal\"\n-- FROM p1\n-- WHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n\nWITH RECURSIVE DateRange AS (\n SELECT generate_series($__timeFrom()::timestamp, $__timeTo()::timestamp, '$__interval') AS timestamp\n),\nLastValues AS (\n SELECT\n dr.timestamp,\n (SELECT delivery_l1 FROM p1 WHERE timestamp <= dr.timestamp AND delivery_l1 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS delivery_l1,\n (SELECT delivery_l2 FROM p1 WHERE timestamp <= dr.timestamp AND delivery_l2 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS delivery_l2,\n (SELECT delivery_l3 FROM p1 WHERE timestamp <= dr.timestamp AND delivery_l3 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS delivery_l3,\n (SELECT delivery_all FROM p1 WHERE timestamp <= dr.timestamp AND delivery_all IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS delivery_all,\n (SELECT returning_l1 FROM p1 WHERE timestamp <= dr.timestamp AND returning_l1 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS returning_l1,\n (SELECT returning_l2 FROM p1 WHERE timestamp <= dr.timestamp AND returning_l2 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS returning_l2,\n (SELECT returning_l3 FROM p1 WHERE timestamp <= dr.timestamp AND returning_l3 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS returning_l3,\n (SELECT returning_all FROM p1 WHERE timestamp <= dr.timestamp AND returning_all IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS returning_all\n FROM DateRange dr\n)\nSELECT\n timestamp,\n COALESCE(delivery_l1, 0) - COALESCE(returning_l1, 0) AS \"Leistung L1\",\n COALESCE(delivery_l2, 0) - COALESCE(returning_l2, 0) AS \"Leistung L2\",\n COALESCE(delivery_l3, 0) - COALESCE(returning_l3, 0) AS \"Leistung L3\",\n COALESCE(delivery_all, 0) - COALESCE(returning_all, 0) AS \"Gesamtleistung\"\nFROM LastValues\nORDER BY timestamp;\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Aktueller Import oder Export", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "watth" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 6, + "x": 12, + "y": 0 + }, + "id": 4, + "options": { + "legend": { + "calcs": [ + "firstNotNull", + "lastNotNull", + "range" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "-- SELECT time_bucket('$__interval', timestamp) AS time, \n-- delivered_tariff1+delivered_tariff2 AS \"Import totaal\", \n-- returned_tariff1+returned_tariff2 AS \"Export totaal\", \n-- delivered_tariff1 AS \"Import telwerk 1\", \n-- delivered_tariff2 AS \"Import telwerk 2\", \n-- returned_tariff1 AS \"Export telwerk 1\", \n-- returned_tariff2 AS \"Export telwerk 2\"\n-- FROM p1\n-- WHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n\nWITH LastKnownValues AS (\n SELECT\n (SELECT delivered_tariff1 FROM p1 WHERE delivered_tariff1 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_delivered_tariff1,\n (SELECT delivered_tariff2 FROM p1 WHERE delivered_tariff2 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_delivered_tariff2,\n (SELECT returned_tariff1 FROM p1 WHERE returned_tariff1 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_returned_tariff1,\n (SELECT returned_tariff2 FROM p1 WHERE returned_tariff2 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_returned_tariff2\n),\nMainQuery AS (\n SELECT\n time_bucket('$__interval', timestamp) AS time,\n delivered_tariff1,\n delivered_tariff2,\n returned_tariff1,\n returned_tariff2\n FROM\n p1\n WHERE\n timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n)\nSELECT\n mq.time,\n (COALESCE(mq.delivered_tariff1, lv.last_delivered_tariff1) + COALESCE(mq.delivered_tariff2, lv.last_delivered_tariff2)) AS \"Import totaal\",\n (COALESCE(mq.returned_tariff1, lv.last_returned_tariff1) + COALESCE(mq.returned_tariff2, lv.last_returned_tariff2)) AS \"Export totaal\",\n COALESCE(mq.delivered_tariff1, lv.last_delivered_tariff1) AS \"Import Zählwerk 1\",\n COALESCE(mq.delivered_tariff2, lv.last_delivered_tariff2) AS \"Import Zählwerk 2\",\n COALESCE(mq.returned_tariff1, lv.last_returned_tariff1) AS \"Export Zählwerk 1\",\n COALESCE(mq.returned_tariff2, lv.last_returned_tariff2) AS \"Export Zählwerk 2\"\nFROM\n MainQuery mq,\n LastKnownValues lv\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Zählerstände Strom", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "description": " Erster + Letzter = seit 0, Bereich = aktueller Zeitraum", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "watth" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 6, + "x": 18, + "y": 0 + }, + "id": 10, + "options": { + "legend": { + "calcs": [ + "firstNotNull", + "lastNotNull", + "range" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "-- SELECT time_bucket('$__interval', timestamp) AS time, \n-- delivered_tariff1-returned_tariff1 AS \"Telwerk 1\", \n-- delivered_tariff2-returned_tariff2 AS \"Telwerk 2\", \n-- delivered_tariff1+delivered_tariff2-returned_tariff1-returned_tariff2 AS \"Totaal\"\n-- FROM p1\n-- WHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n\nWITH LastKnownValues AS (\n SELECT\n (SELECT delivered_tariff1 FROM p1 WHERE delivered_tariff1 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_delivered_tariff1,\n (SELECT delivered_tariff2 FROM p1 WHERE delivered_tariff2 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_delivered_tariff2,\n (SELECT returned_tariff1 FROM p1 WHERE returned_tariff1 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_returned_tariff1,\n (SELECT returned_tariff2 FROM p1 WHERE returned_tariff2 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_returned_tariff2\n),\nMainQuery AS (\n SELECT\n time_bucket('$__interval', timestamp) AS time,\n COALESCE(delivered_tariff1, (SELECT last_delivered_tariff1 FROM LastKnownValues)) AS delivered_tariff1,\n COALESCE(delivered_tariff2, (SELECT last_delivered_tariff2 FROM LastKnownValues)) AS delivered_tariff2,\n COALESCE(returned_tariff1, (SELECT last_returned_tariff1 FROM LastKnownValues)) AS returned_tariff1,\n COALESCE(returned_tariff2, (SELECT last_returned_tariff2 FROM LastKnownValues)) AS returned_tariff2\n FROM\n p1\n WHERE\n timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n)\nSELECT\n time,\n (delivered_tariff1 - returned_tariff1) AS \"Zählwerk 1\",\n (delivered_tariff2 - returned_tariff2) AS \"Zählwerk 2\",\n (delivered_tariff1 + delivered_tariff2 - returned_tariff1 - returned_tariff2) AS \"Gesamt\"\nFROM\n MainQuery\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Saldiert Zählerstände", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "description": "Min: 216,2V. Max: 253V. (-6% bis +10%)", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "volt" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 3, + "options": { + "legend": { + "calcs": [ + "logmin", + "max", + "mean", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT time_bucket('$__interval', timestamp) AS time, \nvoltage_l1 AS \"Spannung L1\", \nvoltage_l2 AS \"Spannung L2\", \nvoltage_l3 AS \"Spannung L3\"\nFROM p1\nWHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Spannung", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "amp" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 10 + }, + "id": 6, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT time_bucket('$__interval', timestamp) AS time, \ncurrent_l1 AS \"Leistung L1\", \ncurrent_l2 AS \"Leistung L2\", \ncurrent_l3 AS \"Leistung L3\"\nFROM p1\nWHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Leistung", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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": 19 + }, + "id": 7, + "options": { + "legend": { + "calcs": [ + "firstNotNull", + "lastNotNull", + "range" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT time_bucket('$__interval', timestamp) AS time, \nfailures AS \"Stromausfall\", \nlong_failures AS \"Längerer Stromausfall\" \nFROM p1\nWHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Stromausfall", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "description": "1L = 1 dm³, also 1kL = 1m³\nBereich = Verbrauch im ausgewählten Zeitraum", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "yellow", + "mode": "fixed" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 50, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "litre" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 19 + }, + "id": 5, + "options": { + "legend": { + "calcs": [ + "firstNotNull", + "lastNotNull", + "range" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT time_bucket('$__interval', timestamp) AS time, \ngas AS \"Gasverbruik\"\nFROM p1\nWHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz AND gas IS NOT NULL", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Gasverbrauch", + "type": "timeseries" + } + ], + "refresh": "5s", + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now/d", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "P1-Messdaten", + "uid": "cf296851-06f4-4479-9d5e-2bf85b56f69d", + "version": 3, + "weekStart": "" + } \ No newline at end of file diff --git a/grafana/P1-meter-readings.json b/grafana/P1-meter-readings.json new file mode 100644 index 0000000..bbbb7a9 --- /dev/null +++ b/grafana/P1-meter-readings.json @@ -0,0 +1,902 @@ +{ + "__inputs": [ + { + "name": "DS_P1", + "label": "p1", + "description": "", + "type": "datasource", + "pluginId": "grafana-postgresql-datasource", + "pluginName": "PostgreSQL" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "11.1.1" + }, + { + "type": "datasource", + "id": "grafana-postgresql-datasource", + "name": "PostgreSQL", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], + "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": null, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "watt" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 8, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean", + "stdDev", + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "-- SELECT time_bucket('$__interval', timestamp) AS time, \n-- delivery_l1 - returning_l1 AS \"Power L1\", \n-- delivery_l2 - returning_l2 AS \"Power L2\", \n-- delivery_l3 - returning_l3 AS \"Power L3\",\n-- delivery_all - returning_all AS \"Power total\"\n-- FROM p1\n-- WHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n\nWITH RECURSIVE DateRange AS (\n SELECT generate_series($__timeFrom()::timestamp, $__timeTo()::timestamp, '$__interval') AS timestamp\n),\nLastValues AS (\n SELECT\n dr.timestamp,\n (SELECT delivery_l1 FROM p1 WHERE timestamp <= dr.timestamp AND delivery_l1 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS delivery_l1,\n (SELECT delivery_l2 FROM p1 WHERE timestamp <= dr.timestamp AND delivery_l2 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS delivery_l2,\n (SELECT delivery_l3 FROM p1 WHERE timestamp <= dr.timestamp AND delivery_l3 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS delivery_l3,\n (SELECT delivery_all FROM p1 WHERE timestamp <= dr.timestamp AND delivery_all IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS delivery_all,\n (SELECT returning_l1 FROM p1 WHERE timestamp <= dr.timestamp AND returning_l1 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS returning_l1,\n (SELECT returning_l2 FROM p1 WHERE timestamp <= dr.timestamp AND returning_l2 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS returning_l2,\n (SELECT returning_l3 FROM p1 WHERE timestamp <= dr.timestamp AND returning_l3 IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS returning_l3,\n (SELECT returning_all FROM p1 WHERE timestamp <= dr.timestamp AND returning_all IS NOT NULL ORDER BY timestamp DESC LIMIT 1) AS returning_all\n FROM DateRange dr\n)\nSELECT\n timestamp,\n COALESCE(delivery_l1, 0) - COALESCE(returning_l1, 0) AS \"Power L1\",\n COALESCE(delivery_l2, 0) - COALESCE(returning_l2, 0) AS \"Power L2\",\n COALESCE(delivery_l3, 0) - COALESCE(returning_l3, 0) AS \"Power L3\",\n COALESCE(delivery_all, 0) - COALESCE(returning_all, 0) AS \"Power total\"\nFROM LastValues\nORDER BY timestamp;\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Current import or export", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "watth" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 6, + "x": 12, + "y": 0 + }, + "id": 4, + "options": { + "legend": { + "calcs": [ + "firstNotNull", + "lastNotNull", + "range" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "-- SELECT time_bucket('$__interval', timestamp) AS time, \n-- delivered_tariff1+delivered_tariff2 AS \"Import total\", \n-- returned_tariff1+returned_tariff2 AS \"Export total\", \n-- delivered_tariff1 AS \"Import register 1\", \n-- delivered_tariff2 AS \"Import register 2\", \n-- returned_tariff1 AS \"Export register 1\", \n-- returned_tariff2 AS \"Export register 2\"\n-- FROM p1\n-- WHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n\nWITH LastKnownValues AS (\n SELECT\n (SELECT delivered_tariff1 FROM p1 WHERE delivered_tariff1 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_delivered_tariff1,\n (SELECT delivered_tariff2 FROM p1 WHERE delivered_tariff2 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_delivered_tariff2,\n (SELECT returned_tariff1 FROM p1 WHERE returned_tariff1 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_returned_tariff1,\n (SELECT returned_tariff2 FROM p1 WHERE returned_tariff2 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_returned_tariff2\n),\nMainQuery AS (\n SELECT\n time_bucket('$__interval', timestamp) AS time,\n delivered_tariff1,\n delivered_tariff2,\n returned_tariff1,\n returned_tariff2\n FROM\n p1\n WHERE\n timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n)\nSELECT\n mq.time,\n (COALESCE(mq.delivered_tariff1, lv.last_delivered_tariff1) + COALESCE(mq.delivered_tariff2, lv.last_delivered_tariff2)) AS \"Import total\",\n (COALESCE(mq.returned_tariff1, lv.last_returned_tariff1) + COALESCE(mq.returned_tariff2, lv.last_returned_tariff2)) AS \"Export total\",\n COALESCE(mq.delivered_tariff1, lv.last_delivered_tariff1) AS \"Import register 1\",\n COALESCE(mq.delivered_tariff2, lv.last_delivered_tariff2) AS \"Import register 2\",\n COALESCE(mq.returned_tariff1, lv.last_returned_tariff1) AS \"Export register 1\",\n COALESCE(mq.returned_tariff2, lv.last_returned_tariff2) AS \"Export register 2\"\nFROM\n MainQuery mq,\n LastKnownValues lv\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Meter readings electricity", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "description": "First + Last = since 0, Range = current time window.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "watth" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 6, + "x": 18, + "y": 0 + }, + "id": 10, + "options": { + "legend": { + "calcs": [ + "firstNotNull", + "lastNotNull", + "range" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "-- SELECT time_bucket('$__interval', timestamp) AS time, \n-- delivered_tariff1-returned_tariff1 AS \"Register 1\", \n-- delivered_tariff2-returned_tariff2 AS \"Register 2\", \n-- delivered_tariff1+delivered_tariff2-returned_tariff1-returned_tariff2 AS \"Total\"\n-- FROM p1\n-- WHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n\nWITH LastKnownValues AS (\n SELECT\n (SELECT delivered_tariff1 FROM p1 WHERE delivered_tariff1 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_delivered_tariff1,\n (SELECT delivered_tariff2 FROM p1 WHERE delivered_tariff2 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_delivered_tariff2,\n (SELECT returned_tariff1 FROM p1 WHERE returned_tariff1 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_returned_tariff1,\n (SELECT returned_tariff2 FROM p1 WHERE returned_tariff2 IS NOT NULL AND timestamp < $__timeFrom()::timestamptz ORDER BY timestamp DESC LIMIT 1) AS last_returned_tariff2\n),\nMainQuery AS (\n SELECT\n time_bucket('$__interval', timestamp) AS time,\n COALESCE(delivered_tariff1, (SELECT last_delivered_tariff1 FROM LastKnownValues)) AS delivered_tariff1,\n COALESCE(delivered_tariff2, (SELECT last_delivered_tariff2 FROM LastKnownValues)) AS delivered_tariff2,\n COALESCE(returned_tariff1, (SELECT last_returned_tariff1 FROM LastKnownValues)) AS returned_tariff1,\n COALESCE(returned_tariff2, (SELECT last_returned_tariff2 FROM LastKnownValues)) AS returned_tariff2\n FROM\n p1\n WHERE\n timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz\n)\nSELECT\n time,\n (delivered_tariff1 - returned_tariff1) AS \"Register 1\",\n (delivered_tariff2 - returned_tariff2) AS \"Register 2\",\n (delivered_tariff1 + delivered_tariff2 - returned_tariff1 - returned_tariff2) AS \"Total\"\nFROM\n MainQuery\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Meter readings (net metered)", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "description": "Min: 216,2V. Max: 253V. (-6% to +10%)", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "volt" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 3, + "options": { + "legend": { + "calcs": [ + "logmin", + "max", + "mean", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT time_bucket('$__interval', timestamp) AS time, \nvoltage_l1 AS \"Voltage L1\", \nvoltage_l2 AS \"Voltage L2\", \nvoltage_l3 AS \"Voltage L3\"\nFROM p1\nWHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Voltage", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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 + } + ] + }, + "unit": "amp" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 10 + }, + "id": 6, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT time_bucket('$__interval', timestamp) AS time, \ncurrent_l1 AS \"Current L1\", \ncurrent_l2 AS \"Current L2\", \ncurrent_l3 AS \"Current L3\"\nFROM p1\nWHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "p1" + } + ], + "title": "Current", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "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": 19 + }, + "id": 7, + "options": { + "legend": { + "calcs": [ + "firstNotNull", + "lastNotNull", + "range" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT time_bucket('$__interval', timestamp) AS time, \nfailures AS \"Power outages\", \nlong_failures AS \"Long power outages\" \nFROM p1\nWHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Power outages", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "description": "1L = 1 dm^3, so 1kL = 1m^3. \nRange = consumption in selected time window.", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "yellow", + "mode": "fixed" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 50, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "litre" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 19 + }, + "id": 5, + "options": { + "legend": { + "calcs": [ + "firstNotNull", + "lastNotNull", + "range" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_P1}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT time_bucket('$__interval', timestamp) AS time, \ngas AS \"Gas consumption\"\nFROM p1\nWHERE timestamp >= $__timeFrom()::timestamptz AND timestamp < $__timeTo()::timestamptz AND gas IS NOT NULL", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Gas consumption", + "type": "timeseries" + } + ], + "refresh": "5s", + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now/d", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "P1 meter readings", + "uid": "cf296851-06f4-4479-9d5e-2bf85b56f69c", + "version": 2, + "weekStart": "" + } \ No newline at end of file