Skip to content

New PyPowerwall Server #254

@jasonacox

Description

@jasonacox

The current pypowerwall proxy does a good job of being a proxy to the Powerwall gateway. It was designed during the days when the Powerwall had a local gateway we could use, including a GUI. This is no longer the case, yet it still emulates "proxy" mode for backward compatibility with systems using those APIs.

Some of you, like @Nexarian, have raised issues that there is no good way to manage multiple gateways. The proxy was never built for this. I've been inspired by @Nexarian to consider a full refactor of the proxy. Since this does not impact the pypowerwall library (but will use it), we can start fresh with a new concept.

The Start:

https://github.com/jasonacox/pypowerwall/tree/main/tools/server

Design Goals:

  • Drop-in replacement - Honor all existing proxy APIs and environment variables (PW_HOST, PW_PASSWORD, PW_CACHE_EXPIRE, etc.)
  • Orchestrated polling - Move from as requested polling to scheduled polling (default 5s) with caching for improved responsiveness
  • Network resilience - Exponential backoff on failures (5s → 120s), graceful degradation serving cached data during outages, non-blocking startup
  • Multi-gateway support - Manage multiple Powerwalls with per-gateway status and aggregate functions
  • Management console - Real-time dashboard for monitoring gateway health, connection status, and troubleshooting (see example below)
  • Modular architecture - FastAPI with async handlers for reliable, testable, high-performance operation and easy extensibility
  • Power Flow animation - Hosted at / with /example showing iframe embed

Technical Approach:

  • Async-first with ThreadPoolExecutor for blocking pypowerwall calls
  • Lazy gateway initialization - server accepts connections immediately
  • Per-gateway health tracking with /health and /stats endpoints
  • TEDAPI, Cloud, and FleetAPI mode support

Example /console display (no, this is not final--sort of gross--just a test):

Image

Provide powerflow animation via /example or /

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions