From 8f248ab21f5f0e56da93b1d57d9b702ded4f03e4 Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Tue, 26 Nov 2024 21:57:40 -0800 Subject: [PATCH] Powerwall Temps support --- RELEASE.md | 9 + VERSION | 2 +- dashboards/dashboard.json | 869 +++++++++++++++++++++++++++++++++++++- powerwall.yml | 10 +- pypowerwall.env.sample | 13 +- telegraf.conf | 5 + upgrade.sh | 2 +- ver.sh | 19 + 8 files changed, 917 insertions(+), 12 deletions(-) create mode 100755 ver.sh diff --git a/RELEASE.md b/RELEASE.md index c2a4ca21..79f5576c 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,14 @@ # RELEASE NOTES +## v4.6.0 - Powerwall Temps + +* Updates to pypowerwall proxy v0.12.0 t66 (https://github.com/jasonacox/pypowerwall/pull/114) which supports a new TEDAPI call to gather vitals that includes Powerwall Temps. +* Updates `telegraf.conf` to read Dashboard VERSION using `ver.sh`. +* Updates `dashboard.json` to include Powerwall Temps and current Dashboard Version. +* Add support for pypowerwall environmental variable `PW_NEG_SOLAR` to allow users to zero out negative values (see `pypowerwall.env.xample`) + +image + ## v4.5.5 - Hotfix * Fix bug introduced in jasonacox/Powerwall-Dashboard/issues/535 as reported in https://github.com/jasonacox/Powerwall-Dashboard/issues/537 by @wagisdev diff --git a/VERSION b/VERSION index 3afbea71..6016e8ad 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.5.5 +4.6.0 diff --git a/dashboards/dashboard.json b/dashboards/dashboard.json index d8ff5bd2..04b89744 100644 --- a/dashboards/dashboard.json +++ b/dashboards/dashboard.json @@ -11121,6 +11121,745 @@ "transparent": true, "type": "timeseries" }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "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": 3600000, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "celsius" + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/^PW1/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#37872D", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/^PW2/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#E0B400", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/^PW3/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#C4162A", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/^PW4/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#1F60C4", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/^PW5/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#FF9830", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/^PW6/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#8F3BB8", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 5, + "w": 24, + "x": 0, + "y": 68 + }, + "id": 86, + "options": { + "legend": { + "calcs": [ + "max", + "min" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "9.1.2", + "targets": [ + { + "alias": "PW1", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW1_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW2", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW2_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW3", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "refId": "C", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW3_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW4", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "refId": "D", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW4_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW5", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "refId": "E", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW5_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW6", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "refId": "F", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW6_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW7", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "query": "SELECT mean(\"PW7_POD_nom_full_pack_energy\") FROM \"pod\".\"http\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "G", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW6_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW8", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "query": "SELECT mean(\"PW8_POD_nom_full_pack_energy\") FROM \"pod\".\"http\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "H", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW7_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW9", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "query": "SELECT mean(\"PW9_POD_nom_full_pack_energy\") FROM \"pod\".\"http\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "I", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW8_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW10", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "query": "SELECT mean(\"PW10_POD_nom_full_pack_energy\") FROM \"pod\".\"http\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "J", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW9_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW11", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "query": "SELECT mean(\"PW11_POD_nom_full_pack_energy\") FROM \"pod\".\"http\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "K", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW10_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW12", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "query": "SELECT mean(\"PW12_POD_nom_full_pack_energy\") FROM \"pod\".\"http\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "L", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW11_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + }, + { + "alias": "PW12", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http", + "orderByTime": "ASC", + "policy": "pwtemps", + "query": "SELECT mean(\"PW12_POD_nom_full_pack_energy\") FROM \"pod\".\"http\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "M", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "PW12_temp" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + } + ], + "title": "Powerwall Temps", + "transparent": true, + "type": "timeseries" + }, { "datasource": { "type": "influxdb", @@ -11250,7 +11989,7 @@ "h": 5, "w": 24, "x": 0, - "y": 68 + "y": 73 }, "id": 38, "interval": "", @@ -12275,7 +13014,7 @@ "h": 5, "w": 24, "x": 0, - "y": 73 + "y": 78 }, "id": 61, "interval": "", @@ -14351,7 +15090,7 @@ "h": 1, "w": 24, "x": 0, - "y": 78 + "y": 83 }, "id": 65, "panels": [], @@ -14518,7 +15257,7 @@ "h": 10, "w": 24, "x": 0, - "y": 79 + "y": 84 }, "id": 68, "options": { @@ -14568,7 +15307,7 @@ "h": 1, "w": 24, "x": 0, - "y": 89 + "y": 94 }, "id": 57, "panels": [], @@ -14765,7 +15504,7 @@ "h": 6, "w": 24, "x": 0, - "y": 90 + "y": 95 }, "hideTimeOverride": false, "id": 59, @@ -15135,7 +15874,7 @@ "h": 7, "w": 24, "x": 0, - "y": 96 + "y": 101 }, "hideTimeOverride": false, "id": 60, @@ -15375,6 +16114,120 @@ "title": "Wind, Pressure and Precipitation ", "transparent": true, "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 108 + }, + "id": 90, + "panels": [], + "title": "Dashboard", + "type": "row" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 24, + "x": 0, + "y": 109 + }, + "id": 88, + "links": [], + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^v$/", + "values": false + }, + "text": { + "valueSize": 12 + }, + "textMode": "value_and_name" + }, + "pluginVersion": "9.1.2", + "targets": [ + { + "alias": "v", + "datasource": { + "type": "influxdb", + "uid": "${DS_INFLUXDB_(AUTO PROVISIONED)}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "powerwall_dashboard", + "orderByTime": "ASC", + "policy": "raw", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "version" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "tags": [] + } + ], + "title": "Powerwall Dashboard", + "transparent": true, + "type": "stat" } ], "refresh": "5m", @@ -15469,6 +16322,6 @@ "timezone": "${VAR_TZ}", "title": "Powerwall - Power Flow", "uid": "RSabAvRRzZ", - "version": 57, + "version": 58, "weekStart": "" } diff --git a/powerwall.yml b/powerwall.yml index 8ada4562..c87a85fd 100644 --- a/powerwall.yml +++ b/powerwall.yml @@ -18,7 +18,7 @@ services: - influxdb.env pypowerwall: - image: jasonacox/pypowerwall:0.11.1t64 + image: jasonacox/pypowerwall:0.12.0t66 container_name: pypowerwall hostname: pypowerwall restart: unless-stopped @@ -56,6 +56,14 @@ services: source: ./telegraf.local target: /etc/telegraf/telegraf.d/local.conf read_only: true + - type: bind + source: ./VERSION + target: /etc/telegraf/VERSION + read_only: true + - type: bind + source: ./ver.sh + target: /etc/telegraf/ver.sh + read_only: true depends_on: - influxdb - pypowerwall diff --git a/pypowerwall.env.sample b/pypowerwall.env.sample index 76261ccb..b64cc183 100644 --- a/pypowerwall.env.sample +++ b/pypowerwall.env.sample @@ -1,7 +1,18 @@ +# Configuration Settings for pyPowerwall + +# Powerwall Settings PW_EMAIL=email@example.com PW_PASSWORD=password PW_HOST=10.0.1.2 PW_TIMEZONE=America/Los_Angeles TZ=America/Los_Angeles -PW_DEBUG=no + +# Powerwall WiFi Gateway Password for TEDAPI Access Mode +PW_GW_PWD= + +# Custom Settings +PW_DEBUG=no # yes/no - Debug logging PW_STYLE=grafana-dark +PW_NEG_SOLAR=yes # Set to no to zero out negative solar values + +# Additional Settings Here diff --git a/telegraf.conf b/telegraf.conf index b7f786f1..36bc0e79 100644 --- a/telegraf.conf +++ b/telegraf.conf @@ -133,6 +133,11 @@ timeout = "4s" data_format = "json" +[[inputs.exec]] + commands = ["/etc/telegraf/ver.sh"] + name_override = "powerwall_dashboard" + data_format = "influx" + # Configuration for sending metrics to InfluxDB #[[outputs.influxdb]] ## The full HTTP or UDP URL for your InfluxDB instance. diff --git a/upgrade.sh b/upgrade.sh index cc89cb3b..4068a195 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -6,7 +6,7 @@ set -e # Set Globals -VERSION="4.5.5" +VERSION="4.6.0" CURRENT="Unknown" COMPOSE_ENV_FILE="compose.env" INFLUXDB_ENV_FILE="influxdb.env" diff --git a/ver.sh b/ver.sh new file mode 100755 index 00000000..f694cbcd --- /dev/null +++ b/ver.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# This script reads the version of Powerwall Dashboard and timestamp + +# Check to see if /etc/telegraf/VERSION exists otherwise use ./VERSION +VER_FILE="/etc/telegraf/VERSION" +if [ ! -f "$VER_FILE" ]; then + VER_FILE="./VERSION" +fi + +# Check to see if the file exists +if [ ! -f "$VER_FILE" ]; then + echo "powerwall_dashboard version=0,file_ts=\"\"" + exit 0 +fi + +version=$(cat $VER_FILE) +timestamp=$(date -r $VER_FILE +"%Y-%m-%d") # Get file modification date + +echo "powerwall_dashboard version=\"${version}\",file_ts=\"${timestamp}\""