From eb4c14781d4fe8db57722cd9d5a02f6a0189032f Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Sat, 20 Jul 2024 17:02:20 -0700 Subject: [PATCH 1/2] Add current and voltage data points --- RELEASE.md | 4 + VERSION | 2 +- dashboards/dashboard.json | 765 +++++++++++++++++++++++++++++++++++++- influxdb/influxdb.sql | 2 + upgrade.sh | 2 +- 5 files changed, 763 insertions(+), 12 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 34bff77c..c3c97b90 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,9 @@ # RELEASE NOTES +## v4.4.6 - Current and Voltage + +* Add data points for system current and voltages (solar, home, grid and powerwall). Includes continuous queries and dashboard.json update. Currently only viable for local mode, non-PW3, systems. + ## v4.4.5 - PW3 Updates * Powerwall 3 Setup Help - If local setup is selected, it will work with the Powerwall 3 but will produce errors in pypowerwall and not have the complete data. This updates `setup.sh` so ensure Powerwall 3 setups use `full` TEDAPI mode for local access. Raised by @pavandave in https://github.com/jasonacox/Powerwall-Dashboard/issues/492. diff --git a/VERSION b/VERSION index fa1ba045..b98ff4c4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.4.5 +4.4.6 diff --git a/dashboards/dashboard.json b/dashboards/dashboard.json index 330299cb..8340983e 100644 --- a/dashboards/dashboard.json +++ b/dashboards/dashboard.json @@ -6377,9 +6377,754 @@ }, "id": 82, "panels": [], - "title": "Powerwall Vitals", + "title": "System Vitals", "type": "row" }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 1, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "volt" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Solar Current" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "yellow", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Home Current" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Grid Current" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "purple", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Powerwall Current" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Solar" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "yellow", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Home" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Grid" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "purple", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Powerwall" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 5, + "w": 12, + "x": 0, + "y": 58 + }, + "id": 85, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "alias": "Solar", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "http", + "orderByTime": "ASC", + "policy": "autogen", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "solar_voltage" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "Home", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "autogen", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "home_voltage" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "Grid", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "autogen", + "refId": "C", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "grid_voltage" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "Powerwall", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "autogen", + "refId": "D", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "pw_voltage" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + } + ], + "title": "Voltage", + "transparent": true, + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "amp" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Solar Current" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "yellow", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Home Current" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Grid Current" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "purple", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Powerwall Current" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Grid" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "purple", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Solar" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "yellow", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Home" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Powerwall" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 5, + "w": 12, + "x": 12, + "y": 58 + }, + "id": 84, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "alias": "Solar", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "http", + "orderByTime": "ASC", + "policy": "autogen", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "solar_current" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "Home", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "autogen", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "home_current" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "Grid", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "autogen", + "refId": "C", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "grid_current" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "Powerwall", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "autogen", + "refId": "D", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "pw_current" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + } + ], + "title": "Current", + "transparent": true, + "type": "timeseries" + }, { "datasource": { "type": "influxdb", @@ -6570,7 +7315,7 @@ "h": 5, "w": 24, "x": 0, - "y": 58 + "y": 63 }, "id": 55, "options": { @@ -7755,7 +8500,7 @@ "h": 5, "w": 24, "x": 0, - "y": 63 + "y": 68 }, "id": 38, "interval": "", @@ -8780,7 +9525,7 @@ "h": 5, "w": 24, "x": 0, - "y": 68 + "y": 73 }, "id": 61, "interval": "", @@ -10856,7 +11601,7 @@ "h": 1, "w": 24, "x": 0, - "y": 73 + "y": 78 }, "id": 65, "panels": [], @@ -11023,7 +11768,7 @@ "h": 10, "w": 24, "x": 0, - "y": 74 + "y": 79 }, "id": 68, "options": { @@ -11073,7 +11818,7 @@ "h": 1, "w": 24, "x": 0, - "y": 84 + "y": 89 }, "id": 57, "panels": [], @@ -11270,7 +12015,7 @@ "h": 6, "w": 24, "x": 0, - "y": 85 + "y": 90 }, "hideTimeOverride": false, "id": 59, @@ -11640,7 +12385,7 @@ "h": 7, "w": 24, "x": 0, - "y": 91 + "y": 96 }, "hideTimeOverride": false, "id": 60, @@ -11974,6 +12719,6 @@ "timezone": "${VAR_TZ}", "title": "Powerwall - Power Flow", "uid": "RSabAvRRzZ", - "version": 55, + "version": 56, "weekStart": "" } diff --git a/influxdb/influxdb.sql b/influxdb/influxdb.sql index 0f3c0920..08deb473 100644 --- a/influxdb/influxdb.sql +++ b/influxdb/influxdb.sql @@ -13,6 +13,8 @@ CREATE RETENTION POLICY grid ON powerwall duration INF replication 1 CREATE RETENTION POLICY pod ON powerwall duration INF replication 1 CREATE RETENTION POLICY alerts ON powerwall duration INF replication 1 CREATE CONTINUOUS QUERY cq_autogen ON powerwall BEGIN SELECT mean(home) AS home, mean(solar) AS solar, mean(from_pw) AS from_pw, mean(to_pw) AS to_pw, mean(from_grid) AS from_grid, mean(to_grid) AS to_grid, last(percentage) AS percentage INTO powerwall.autogen.:MEASUREMENT FROM (SELECT load_instant_power AS home, solar_instant_power AS solar, abs((1+battery_instant_power/abs(battery_instant_power))*battery_instant_power/2) AS from_pw, abs((1-battery_instant_power/abs(battery_instant_power))*battery_instant_power/2) AS to_pw, abs((1+site_instant_power/abs(site_instant_power))*site_instant_power/2) AS from_grid, abs((1-site_instant_power/abs(site_instant_power))*site_instant_power/2) AS to_grid, percentage FROM raw.http) GROUP BY time(1m), month, year fill(linear) END +CREATE CONTINUOUS QUERY cq_autogen_current ON powerwall BEGIN SELECT mean(home) AS home_current, mean(solar) AS solar_current, mean(pw) AS pw_current, mean(grid) AS grid_current INTO powerwall.autogen.:MEASUREMENT FROM (SELECT load_instant_total_current AS home, solar_instant_total_current AS solar, battery_instant_total_current AS pw, site_instant_total_current AS grid FROM raw.http) GROUP BY time(1m), month, year fill(linear) END +CREATE CONTINUOUS QUERY cq_autogen_voltage ON powerwall BEGIN SELECT mean(home) AS home_voltage, mean(solar) AS solar_voltage, mean(pw) AS pw_voltage, mean(grid) AS grid_voltage INTO powerwall.autogen.:MEASUREMENT FROM (SELECT load_instant_average_voltage AS home, solar_instant_average_voltage AS solar, battery_instant_average_voltage AS pw, site_instant_average_voltage AS grid FROM raw.http) GROUP BY time(1m), month, year fill(linear) END CREATE CONTINUOUS QUERY cq_kwh ON powerwall RESAMPLE EVERY 1m BEGIN SELECT integral(home)/1000/3600 AS home, integral(solar)/1000/3600 AS solar, integral(from_pw)/1000/3600 AS from_pw, integral(to_pw)/1000/3600 AS to_pw, integral(from_grid)/1000/3600 AS from_grid, integral(to_grid)/1000/3600 AS to_grid INTO powerwall.kwh.:MEASUREMENT FROM autogen.http GROUP BY time(1h), month, year tz('America/Los_Angeles') END CREATE CONTINUOUS QUERY cq_daily ON powerwall RESAMPLE EVERY 1h BEGIN SELECT sum(home) AS home, sum(solar) AS solar, sum(from_pw) AS from_pw, sum(to_pw) AS to_pw, sum(from_grid) AS from_grid, sum(to_grid) AS to_grid INTO powerwall.daily.:MEASUREMENT FROM powerwall.kwh.http GROUP BY time(1d), month, year tz('America/Los_Angeles') END CREATE CONTINUOUS QUERY cq_monthly ON powerwall RESAMPLE EVERY 1h BEGIN SELECT sum(home) AS home, sum(solar) AS solar, sum(from_pw) AS from_pw, sum(to_pw) AS to_pw, sum(from_grid) AS from_grid, sum(to_grid) AS to_grid INTO powerwall.monthly.:MEASUREMENT FROM powerwall.daily.http GROUP BY time(365d), month, year END diff --git a/upgrade.sh b/upgrade.sh index 8d36c028..a63c6ae6 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -6,7 +6,7 @@ set -e # Set Globals -VERSION="4.4.5" +VERSION="4.4.6" CURRENT="Unknown" COMPOSE_ENV_FILE="compose.env" INFLUXDB_ENV_FILE="influxdb.env" From 9ec16d8e6cb395dd50b1a1fbd98a3c2d61010eff Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Sun, 21 Jul 2024 16:21:57 -0700 Subject: [PATCH 2/2] Upgrade pypowerwall proxy to v0.10.9 --- RELEASE.md | 1 + powerwall.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index c3c97b90..809cb43c 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,6 +3,7 @@ ## v4.4.6 - Current and Voltage * Add data points for system current and voltages (solar, home, grid and powerwall). Includes continuous queries and dashboard.json update. Currently only viable for local mode, non-PW3, systems. +* Upgrade pypowerwall proxy to v0.10.9 to include TEDAPI mode patch that adds computed voltage and current to aggregates (https://github.com/jasonacox/pypowerwall/pull/107). ## v4.4.5 - PW3 Updates diff --git a/powerwall.yml b/powerwall.yml index 1694d6c6..7be2f91e 100644 --- a/powerwall.yml +++ b/powerwall.yml @@ -18,7 +18,7 @@ services: - influxdb.env pypowerwall: - image: jasonacox/pypowerwall:0.10.8t63 + image: jasonacox/pypowerwall:0.10.9t63 container_name: pypowerwall hostname: pypowerwall restart: unless-stopped