Skip to content

Latest commit

 

History

History

proxy

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

pyPowerwall Proxy Server

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]

Quick Start

  1. 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
  2. Test the Proxy

    curl -i http://localhost:8675/soe
    curl -i http://localhost:8675/aggregates

Build Your Own

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.

  1. Build the Docker Container

    docker build -t pypowerwall:latest .
  2. Setup the Docker Container to listen on port 8675.

    docker run \
    -d \
    -p 8675:8675 \
    --name pypowerwall \
    --restart unless-stopped \
    pypowerwall
  3. Test the Proxy

    curl -i http://localhost:8675/soe
    curl -i http://localhost:8675/aggregates

Troubleshooting Help

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