This proxy tool will handle authentication to the Powerwall Gateway and will proxy API calls to /api/meters/aggregates (power metrics) and /api/system_status/soe (battery level). With the instructions below, you can containerize this proxy and run it as an endpoint for tools like telegraf to pull metrics without needing to authenticate.
Because pyPowerwall is designed to cache the auth and high frequency API calls, this will reduce the load on the Gateway and prevent crash/restart issues that can happen if too many session are created on the Gateway.
Docker: docker pull (jasonacox/pypowerwall)[https://hub.docker.com/r/jasonacox/pypowerwall]
-
Run the Docker Container to listen on port 8675. Update the
-e
values for your Powerwall.docker run \ -d \ -p 8675:8675 \ -e PW_PASSWORD='password' \ -e PW_EMAIL='[email protected]' \ -e PW_HOST='localhost' \ -e PW_TIMEZONE='America/Los_Angeles' \ -e PW_CACHE_EXPIRE='5' \ -e PW_DEBUG='no' \ --name pypowerwall \ --restart unless-stopped \ jasonacox/pypowerwall
-
Test the Proxy
curl -i http://localhost:8675/soe curl -i http://localhost:8675/aggregates
This folder contains the server.py
script that runs a simple python based webserver that makes the pyPowerwall API calls.
The Dockerfile
here will allow you to containerize the proxy server for clean installation and running.
-
Build the Docker Container
docker build -t pypowerwall:latest .
-
Setup the Docker Container to listen on port 8675.
docker run \ -d \ -p 8675:8675 \ --name pypowerwall \ --restart unless-stopped \ pypowerwall
-
Test the Proxy
curl -i http://localhost:8675/soe curl -i http://localhost:8675/aggregates
Check the logs:
# See the logs
docker logs pypowerwall
If you see python errors, make sure you entered your credentials correctly in the server.py
file. If you didn't, edit that file and restart docker:
# Stop the server
docker stop pypowerwall
# Start the server
docker start pypowerwall