Skip to content

Commit

Permalink
Merge pull request #479 from jasonacox/v4.4.0
Browse files Browse the repository at this point in the history
V4.4.0 - Vitals and FleetAPI
  • Loading branch information
jasonacox authored Jun 8, 2024
2 parents 003811d + 1deb9fa commit 122fe76
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 11 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ Since [weather411](https://hub.docker.com/r/jasonacox/weather411) is part of thi
**Data Retention and Backups**
InfluxDB is configured to use a infinite retention policy (see [influxdb.sql](../influxdb/influxdb.sql)). It uses continuous queries to downsample Powerwall data and preserve disk space. However, this does not safeguard the data from accidental deletion or corruption. It is recommend that you set up a backup plan to snapshot the data for disaster recovery. See [backups](backups/) for some suggestions.
### Other Tools and Related Projects
* NetZero app - iOS and Android App for monitoring your System - https://www.netzeroapp.io/
### Credits
* This project is based on the great work by mihailescu2m at [https://github.com/mihailescu2m/powerwall_monitor](https://github.com/mihailescu2m/powerwall_monitor) and has been modified to use pypowerwall as a proxy to the Powerwall and includes solar String, Inverter and Powerwall Temperature graphs for Powerwall+ systems.
Expand Down
14 changes: 14 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# RELEASE NOTES

## v4.4.0 - FleetAPI and TEDAPI

* Add TEDAPI Support for Extended Device Metrics (the return of most of `/vitals`) - This requires connecting to Powerwall WiFi directly or setting up a network route on the Dashboard host to allow it to reach the GW address (192.168.91.1).
* Add support for Tesla's official API, [FleetAPI](https://developer.tesla.com/docs/fleet-api). This requires additional registration and configuration. Instructions are part of setup process or on the project page.
* Run `upgrade.sh` and then run `setup.sh` to choose these new options.
* Upgrade to [pyPowerwall v0.10.0](https://github.com/jasonacox/pypowerwall/releases/tag/v0.10.0) proxy t58 - Release addresses some issues, including fixing Solar Only grid_status issues as reported by @lsgc123 in https://github.com/jasonacox/Powerwall-Dashboard/issues/478
* Fix setup.sh for docker group permission bug identified by @hulkster in #476

* Addresses several open issues and discussions:
* https://github.com/jasonacox/Powerwall-Dashboard/discussions/392
* https://github.com/jasonacox/Powerwall-Dashboard/discussions/402
* https://github.com/jasonacox/Powerwall-Dashboard/issues/436
* https://github.com/jasonacox/Powerwall-Dashboard/issues/472

## v4.3.2 - Solar Only Fix

* Upgrade to pyPowerwall v0.8.5 proxy t56
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.2
4.4.0
2 changes: 1 addition & 1 deletion powerwall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
- influxdb.env

pypowerwall:
image: jasonacox/pypowerwall:0.8.5t56
image: jasonacox/pypowerwall:0.10.0t58
container_name: pypowerwall
hostname: pypowerwall
restart: unless-stopped
Expand Down
76 changes: 71 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ INFLUXDB_ENV_FILE="influxdb.env"
TELEGRAF_LOCAL="telegraf.local"
PW_ENV_FILE="pypowerwall.env"
GF_ENV_FILE="grafana.env"
PW_STYLE="grafana-dark"

if [ ! -f VERSION ]; then
echo "ERROR: Missing VERSION file. Setup must run from installation directory."
Expand All @@ -36,7 +37,7 @@ fi

# Verify user in docker group (not required for Windows Git Bash)
if ! type winpty > /dev/null 2>&1; then
if ! $(id -Gn 2>/dev/null | grep -qE " docker( |$)"); then
if ! $(id -Gn 2>/dev/null | grep -qw "docker"); then
echo "WARNING: You do not appear to be in the docker group."
echo ""
echo "Please ensure your local user is in the docker group and run without sudo."
Expand Down Expand Up @@ -111,15 +112,18 @@ echo "Select configuration mode:"
echo ""
echo "Current: ${config}"
echo ""
echo " 1 - Local Access (Powerwall 1, 2, or + using the Tesla Gateway on LAN) - Default"
echo " 2 - Tesla Cloud (Solar-only systems or Powerwalls without LAN access)"
echo " 1 - Local Access (Powerwall 1, 2, or + using the Tesla Gateway on LAN) - Default"
echo " 2 - Tesla Cloud (Solar-only systems or Powerwalls without LAN access)"
echo " 3 - FleetAPI Cloud (Powerwall systems using Official Telsa API)"
echo ""
while :; do
read -r -p "Select mode: ${choice}" response
if [ "${response}" == "1" ]; then
selected="Local Access"
elif [ "${response}" == "2" ]; then
selected="Tesla Cloud"
elif [ "${response}" == "3" ]; then
selected="FleetAPI Cloud"
elif [ -z "${response}" ] && [ ! -z "${choice}" ]; then
selected="${config}"
else
Expand Down Expand Up @@ -237,6 +241,19 @@ if [ -f ${PW_ENV_FILE} ]; then
fi
fi

# Function to test an IP to see if it returns a ping
function test_ip() {
local IP=$1
if [ -z "${IP}" ]; then
return 1
fi
if ping -c 1 -W 1 ${IP} > /dev/null 2>&1; then
return 0
else
return 1
fi
}

# Create Powerwall Settings
if [ ! -f ${PW_ENV_FILE} ]; then
if [ "${config}" == "Local Access" ]; then
Expand All @@ -247,20 +264,61 @@ if [ ! -f ${PW_ENV_FILE} ]; then
while [ -z "${EMAIL}" ]; do
read -p 'Email: ' EMAIL
done
read -p 'IP Address (leave blank to scan network): ' IP
IP=""
# Can we reach 192.168.91.1
if test_ip "192.168.91.1"; then
IP="192.168.91.1"
echo "Found Powerwall Gateway at ${IP}"
read -p 'Use this IP? [Y/n] ' response
if [[ "$response" =~ ^([nN][oO]|[nN])$ ]]; then
IP=""
else
echo "Congratulations!"
echo "Extended Device Metrics (vitals) are available on this endpoint via TEDAPI."
echo "However, you will need the Gateway password to access them."
echo "This password is often on the QR code on the Powerwall Gateway unit."
echo ""
read -p 'Enter Gateway Password or leave blank to disable: ' PW
if [ -z "${PW}" ]; then
PW_GW_PWD=""
else
PW_GW_PWD="${PW}"
fi
fi
else
echo "The Powerwall Gateway (192.168.91.1) is not found on your LAN."
echo "Standard dashboard metrics will work but Extended data (vitals) via TEDAPI"
echo "will not be available. Consult the project for information on how to enable."
echo "Proceeding with standard metrics..."
echo ""
fi
if [ -z "${IP}" ]; then
read -p 'Powerwall IP Address (leave blank to scan network): ' IP
fi
else
echo "Enter email address for Tesla Account..."
while [ -z "${EMAIL}" ]; do
read -p 'Email: ' EMAIL
done
echo "If you have a Solar-only system, you can customize the dashboard for Solar and"
echo "hide the Powerwall metrics."
echo ""
# ask if user has a solar only system
read -p 'Set dashboard to Solar-only system? [y/N] ' response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
PW_STYLE="solar"
fi
fi
echo "PW_EMAIL=${EMAIL}" > ${PW_ENV_FILE}
echo "PW_PASSWORD=${PASSWORD}" >> ${PW_ENV_FILE}
echo "PW_HOST=${IP}" >> ${PW_ENV_FILE}
echo "PW_TIMEZONE=America/Los_Angeles" >> ${PW_ENV_FILE}
echo "TZ=America/Los_Angeles" >> ${PW_ENV_FILE}
echo "PW_DEBUG=no" >> ${PW_ENV_FILE}
echo "PW_STYLE=grafana-dark" >> ${PW_ENV_FILE}
echo "PW_STYLE=${PW_STYLE}" >> ${PW_ENV_FILE}
if [ ! -z "${PW_GW_PWD}" ]; then
echo "PW_GW_PWD=${PW_GW_PWD}" >> ${PW_ENV_FILE}
fi
fi

# Create default telegraf local file if needed.
Expand Down Expand Up @@ -330,6 +388,14 @@ if [ "${config}" == "Tesla Cloud" ]; then
echo "-----------------------------------------"
fi

# Run FleetAPI mode setup
if [ "${config}" == "FleetAPI Cloud" ]; then
docker exec -it pypowerwall python3 -m pypowerwall fleetapi
echo "Restarting..."
docker restart pypowerwall
echo "-----------------------------------------"
fi

# Set up Influx
echo "Waiting for InfluxDB to start..."
until running http://localhost:8086/ping 204 2>/dev/null; do
Expand Down
21 changes: 17 additions & 4 deletions upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
set -e

# Set Globals
VERSION="4.3.2"
VERSION="4.4.0"
CURRENT="Unknown"
COMPOSE_ENV_FILE="compose.env"
INFLUXDB_ENV_FILE="influxdb.env"
Expand Down Expand Up @@ -186,7 +186,7 @@ if [ "${PROFILE}" == "solar-only" ]; then
echo "PW_TIMEZONE=America/Los_Angeles" >> ${PW_ENV_FILE}
echo "TZ=America/Los_Angeles" >> ${PW_ENV_FILE}
echo "PW_DEBUG=no" >> ${PW_ENV_FILE}
echo "PW_STYLE=grafana-dark" >> ${PW_ENV_FILE}
echo "PW_STYLE=solar" >> ${PW_ENV_FILE}
fi

# Remove use of COMPOSE_PROFILES (deprecated as of 4.0.0)
Expand Down Expand Up @@ -260,8 +260,21 @@ fi
# Check for PW_STYLE setting and add if missing
if ! grep -q "PW_STYLE" ${PW_ENV_FILE}; then
echo "Your pypowerwall environmental settings are missing PW_STYLE."
echo "Adding..."
echo "PW_STYLE=grafana-dark" >> ${PW_ENV_FILE}
# Check to see if they are solar only
if grep -q "PW_HOST=" ${PW_ENV_FILE}; then
echo "Do you want to use the solar-only style?"
read -r -p "Use solar-only style? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
echo "Adding..."
echo "PW_STYLE=solar" >> ${PW_ENV_FILE}
else
echo "Adding..."
echo "PW_STYLE=grafana-dark" >> ${PW_ENV_FILE}
fi
else
echo "Adding..."
echo "PW_STYLE=grafana-dark" >> ${PW_ENV_FILE}
fi

# Check to see that TZ is set in pypowerwall
Expand Down

0 comments on commit 122fe76

Please sign in to comment.