diff --git a/proxy/RELEASE.md b/proxy/RELEASE.md index f747113..88b193f 100644 --- a/proxy/RELEASE.md +++ b/proxy/RELEASE.md @@ -1,5 +1,14 @@ ## pyPowerwall Proxy Release Notes +### Proxy t68 (20 Jan 2025) + +* pyPowerwall v0.12.3 - Adds Custom GW IP for TEDAPI. +* Add new API /csv/v2 which extends /csv by adding grids status (1/0) and battery reserve (%)setting: + +```python +# Grid,Home,Solar,Battery,Battery_Level,Grid_Status,Reserve +``` + ### Proxy t67 (26 Dec 2024) * pyPowerwall v0.12.2 - Fix bug in cache timeout code that was not honoring pwcacheexpire setting. Raised by @erikgiesele in https://github.com/jasonacox/pypowerwall/issues/122 - PW_CACHE_EXPIRE=0 not possible? (Proxy) diff --git a/proxy/requirements.txt b/proxy/requirements.txt index d230597..33a1a12 100644 --- a/proxy/requirements.txt +++ b/proxy/requirements.txt @@ -1,2 +1,2 @@ -pypowerwall==0.12.2 +pypowerwall==0.12.3 bs4==0.0.2 diff --git a/proxy/server.py b/proxy/server.py index afe1e00..e34db48 100755 --- a/proxy/server.py +++ b/proxy/server.py @@ -54,7 +54,7 @@ import pypowerwall from pypowerwall import parse_version -BUILD = "t67" +BUILD = "t68" ALLOWLIST = [ '/api/status', '/api/site_info/site_name', '/api/meters/site', '/api/meters/solar', '/api/sitemaster', '/api/powerwalls', @@ -369,8 +369,9 @@ def do_GET(self): elif self.path == '/api/system_status/grid_status': # Grid Status - JSON message: str = pw.poll('/api/system_status/grid_status', jsonformat=True) - elif self.path == '/csv': - # Grid,Home,Solar,Battery,Level - CSV + elif self.path == '/csv' or self.path == '/csv/v2': + # CSV Output - Grid,Home,Solar,Battery,Level + # CSV2 Output - Grid,Home,Solar,Battery,Level,GridStatus,Reserve contenttype = 'text/plain; charset=utf-8' batterylevel = pw.level() or 0 grid = pw.grid() or 0 @@ -381,8 +382,15 @@ def do_GET(self): solar = 0 # Shift energy from solar to load home -= solar - message = "%0.2f,%0.2f,%0.2f,%0.2f,%0.2f\n" \ - % (grid, home, solar, battery, batterylevel) + if self.path == '/csv': + message = "%0.2f,%0.2f,%0.2f,%0.2f,%0.2f\n" \ + % (grid, home, solar, battery, batterylevel) + else: + gridstatus = 1 if pw.grid_status() == 'UP' else 0 + reserve = pw.get_reserve() or 0 + message = "%0.2f,%0.2f,%0.2f,%0.2f,%0.2f,%d,%d\n" \ + % (grid, home, solar, battery, batterylevel, + gridstatus, reserve) elif self.path == '/vitals': # Vitals Data - JSON message: str = pw.vitals(jsonformat=True) or json.dumps({})