Mercurial > ~darius > hgwebdir.cgi > pw2log
view Grafana-dashboard.json @ 5:c02b765b4eb3 default tip
Add grafana dashboard configuration.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Fri, 21 Jul 2023 19:57:53 +0930 |
parents | |
children |
line wrap: on
line source
{ "annotations": { "list": [ { "$$hashKey": "object:7", "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": 2, "id": 4, "links": [], "liveNow": false, "panels": [ { "aliasColors": { "Battery": "red", "Grid": "blue", "Solar": "green", "battery_power": "red", "grid_power": "blue", "solar_power": "green" }, "bars": false, "dashLength": 10, "dashes": false, "datasource": { "type": "postgres", "uid": "000000004" }, "fieldConfig": { "defaults": { "links": [] }, "overrides": [] }, "fill": 0, "fillGradient": 0, "gridPos": { "h": 11, "w": 24, "x": 0, "y": 0 }, "hiddenSeries": false, "id": 2, "legend": { "avg": false, "current": false, "max": false, "min": false, "show": true, "total": false, "values": false }, "lines": true, "linewidth": 1, "nullPointMode": "null", "options": { "alertThreshold": true }, "percentage": false, "pluginVersion": "8.5.4", "pointradius": 2, "points": false, "renderer": "flot", "seriesOverrides": [ { "alias": "battery_charge", "yaxis": 2 }, { "alias": "Charge", "yaxis": 2 } ], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "format": "time_series", "group": [], "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n $__time(date),\n grid_power AS \"Grid\",\n load_power AS \"Load\",\n battery_power AS \"Battery\",\n battery_charge AS \"Charge\",\n solar_power AS \"Solar\"\nFROM\n pw2\nWHERE\n $__timeFilter(date)\n", "refId": "A", "select": [ [ { "params": [ "value" ], "type": "column" } ] ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "thresholds": [], "timeRegions": [ { "$$hashKey": "object:42", "colorMode": "yellow", "fill": true, "fillColor": "rgba(234, 112, 112, 0.12)", "from": "15:30", "line": false, "lineColor": "rgba(237, 46, 24, 0.60)", "op": "time", "to": "20:30" }, { "$$hashKey": "object:70", "colorMode": "green", "fill": true, "fillColor": "rgba(234, 112, 112, 0.12)", "from": "00:30", "line": false, "lineColor": "rgba(237, 46, 24, 0.60)", "op": "time", "to": "05:30" } ], "title": "Charge / Power", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "mode": "time", "show": true, "values": [] }, "yaxes": [ { "$$hashKey": "object:202", "format": "watt", "logBase": 1, "max": "6000", "min": "-6000", "show": true }, { "$$hashKey": "object:203", "format": "percent", "logBase": 1, "max": "100", "min": "0", "show": true } ], "yaxis": { "align": false } }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": { "type": "postgres", "uid": "000000004" }, "fieldConfig": { "defaults": { "links": [] }, "overrides": [] }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 9, "w": 24, "x": 0, "y": 11 }, "hiddenSeries": false, "id": 6, "legend": { "alignAsTable": false, "avg": false, "current": true, "max": false, "min": false, "rightSide": false, "show": true, "total": false, "values": true }, "lines": true, "linewidth": 1, "nullPointMode": "null", "options": { "alertThreshold": true }, "percentage": false, "pluginVersion": "8.5.4", "pointradius": 2, "points": false, "renderer": "flot", "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "format": "time_series", "group": [], "metricColumn": "none", "rawQuery": true, "rawSql": "WITH foo AS (\n SELECT \n date,\n solar_power * EXTRACT(seconds FROM date - lag(date) OVER (ORDER BY date ASC)) / 3600 AS solar_wh,\n load_power * EXTRACT(seconds FROM date - lag(date) OVER (ORDER BY date ASC)) / 3600 AS load_wh,\n CASE WHEN grid_power > 0 THEN grid_power * EXTRACT(seconds FROM date - lag(date) OVER (ORDER BY date ASC)) / 3600 END AS grid_import_wh,\n CASE WHEN grid_power < 0 THEN -grid_power * EXTRACT(seconds FROM date - lag(date) OVER (ORDER BY date ASC)) / 3600 END AS grid_export_wh,\n CASE WHEN battery_power > 0 THEN battery_power * EXTRACT(seconds FROM date - lag(date) OVER (ORDER BY date ASC)) / 3600 END AS battery_discharge_wh,\n CASE WHEN battery_power < 0 THEN -battery_power * EXTRACT(seconds FROM date - lag(date) OVER (ORDER BY date ASC)) / 3600 END AS battery_charge_wh\n FROM pw2\n WHERE $__timeFilter(date)\n ORDER BY date ASC\n)\nSELECT\n date AS time,\n SUM(solar_wh) OVER (ORDER BY date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS \"Solar Generation\",\n SUM(load_wh) OVER (ORDER BY date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS \"Consumption\",\n SUM(grid_import_wh) OVER (ORDER BY date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS \"Grid Import\",\n SUM(grid_export_wh) OVER (ORDER BY date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS \"Grid Export\",\n SUM(battery_discharge_wh) OVER (ORDER BY date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS \"Battery Discharge\",\n SUM(battery_charge_wh) OVER (ORDER BY date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS \"Battery Charge\"\nFROM foo;", "refId": "A", "select": [ [ { "params": [ "value" ], "type": "column" } ] ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "thresholds": [], "timeRegions": [], "title": "Cumulative Energy", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "mode": "time", "show": true, "values": [] }, "yaxes": [ { "format": "watth", "logBase": 1, "show": true }, { "format": "short", "logBase": 1, "show": true } ], "yaxis": { "align": false } }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": { "type": "postgres", "uid": "000000004" }, "fieldConfig": { "defaults": { "links": [] }, "overrides": [] }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 9, "w": 24, "x": 0, "y": 20 }, "hiddenSeries": false, "id": 7, "legend": { "alignAsTable": false, "avg": false, "current": true, "max": false, "min": false, "rightSide": false, "show": true, "total": false, "values": true }, "lines": true, "linewidth": 1, "nullPointMode": "null", "options": { "alertThreshold": true }, "percentage": false, "pluginVersion": "8.5.4", "pointradius": 2, "points": false, "renderer": "flot", "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "datasource": { "type": "postgres", "uid": "000000004" }, "format": "time_series", "group": [], "metricColumn": "none", "rawQuery": true, "rawSql": "WITH bar AS (\n WITH foo AS (\n SELECT\n date as time,\n EXTRACT('hour' FROM DATE_TRUNC('hour', date)) AS hour,\n CASE WHEN EXTRACT('hour' FROM DATE_TRUNC('hour', date)) BETWEEN 1 AND 6 THEN 36.63\n WHEN EXTRACT('hour' FROM DATE_TRUNC('hour', date)) BETWEEN 10 AND 15 THEN 31.548\n ELSE 48.312\n END AS rate,\n 14 AS tarrif,\n CASE WHEN grid_power > 0 THEN grid_power * EXTRACT(seconds FROM date - lag(date) OVER (ORDER BY date ASC)) / 3600 ELSE 0 END AS grid_import_wh,\n CASE WHEN grid_power < 0 THEN -grid_power * EXTRACT(seconds FROM date - lag(date) OVER (ORDER BY date ASC)) / 3600 ELSE 0 END AS grid_export_wh\n FROM pw2\n WHERE $__timeFilter(date)\n ORDER BY date ASC\n )\n SELECT\n time,\n rate,\n grid_import_wh / 1000 * rate / 100 AS grid_import_dollars,\n grid_export_wh / 1000 * tarrif / 100 AS grid_export_dollars\n FROM foo\n )\nSELECT\n time,\n SUM(grid_import_dollars) OVER (ORDER BY time ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS \"Import\",\n SUM(grid_export_dollars) OVER (ORDER BY time ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS \"Export\",\n SUM(grid_import_dollars) OVER (ORDER BY time ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) -\n SUM(grid_export_dollars) OVER (ORDER BY time ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS \"Net\"\n FROM bar;", "refId": "A", "select": [ [ { "params": [ "value" ], "type": "column" } ] ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "thresholds": [], "timeRegions": [], "title": "Cost (excl. supply charge)", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "mode": "time", "show": true, "values": [] }, "yaxes": [ { "$$hashKey": "object:61", "format": "currencyUSD", "logBase": 1, "show": true }, { "$$hashKey": "object:62", "format": "currencyUSD", "logBase": 1, "show": true } ], "yaxis": { "align": false } }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": { "type": "postgres", "uid": "000000004" }, "fieldConfig": { "defaults": { "links": [] }, "overrides": [] }, "fill": 0, "fillGradient": 0, "gridPos": { "h": 8, "w": 24, "x": 0, "y": 29 }, "hiddenSeries": false, "id": 4, "legend": { "avg": false, "current": false, "max": false, "min": false, "show": true, "total": false, "values": false }, "lines": true, "linewidth": 2, "nullPointMode": "null", "options": { "alertThreshold": true }, "percentage": false, "pluginVersion": "8.5.4", "pointradius": 2, "points": false, "renderer": "flot", "seriesOverrides": [ { "$$hashKey": "object:337", "alias": "Frequency", "yaxis": 2, "zindex": -1 } ], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "datasource": { "type": "postgres", "uid": "000000004" }, "format": "time_series", "group": [], "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n $__time(date),\n grid_voltage AS \"Voltage\",\n grid_freq AS \"Frequency\"\nFROM\n pw2\nWHERE\n $__timeFilter(date)\n", "refId": "A", "select": [ [ { "params": [ "value" ], "type": "column" } ] ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "thresholds": [], "timeRegions": [], "title": "Grid", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "mode": "time", "show": true, "values": [] }, "yaxes": [ { "$$hashKey": "object:266", "decimals": 1, "format": "volt", "label": "", "logBase": 1, "max": "260", "min": "230", "show": true }, { "$$hashKey": "object:267", "decimals": 2, "format": "short", "label": "", "logBase": 1, "max": "51", "min": "49", "show": true } ], "yaxis": { "align": false } } ], "refresh": "", "schemaVersion": 36, "style": "dark", "tags": [], "templating": { "list": [] }, "time": { "from": "now/d", "to": "now/d" }, "timepicker": { "hidden": false, "refresh_intervals": [ "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d" ] }, "timezone": "", "title": "Powerwall", "uid": "IsSsdrTZz", "version": 24, "weekStart": "" }