From fed55928d5555994dddf2a7de2df1514f7d57407 Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Sun, 25 Feb 2024 20:39:02 -0800 Subject: [PATCH] v0.7.8 --- RELEASE.md | 3 ++- proxy/Dockerfile | 2 +- proxy/server.py | 9 +++++++-- pypowerwall/__init__.py | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index a3e626d..99d7a59 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,8 +1,9 @@ # RELEASE NOTES -## v0.7.8 - Cloud Setup Fix +## v0.7.8 - Cloud Fixes * Fix enumeration of energy sites during `cloud mode` setup to handle incomplete sites with Unknown names or types by @dcgibbons in https://github.com/jasonacox/pypowerwall/pull/72 +* Proxy t41 Updates - Bug fixes for Solar-Only systems using `cloud mode` (see https://github.com/jasonacox/Powerwall-Dashboard/issues/437). ## v0.7.7 - Battery Data and Network Scanner diff --git a/proxy/Dockerfile b/proxy/Dockerfile index c61561f..504c5bf 100644 --- a/proxy/Dockerfile +++ b/proxy/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.10-alpine WORKDIR /app -RUN pip3 install pypowerwall==0.7.7 bs4 +RUN pip3 install pypowerwall==0.7.8 bs4 COPY . . CMD ["python3", "server.py"] EXPOSE 8675 diff --git a/proxy/server.py b/proxy/server.py index 2d0fe31..43df79e 100755 --- a/proxy/server.py +++ b/proxy/server.py @@ -417,6 +417,8 @@ def do_GET(self): message = message + "\n" message = message + '\n

Page refresh: %s

\n\n' % ( str(datetime.datetime.fromtimestamp(time.time()))) + elif self.path == '/api/troubleshooting/problems': + message = pw.poll('/api/troubleshooting/problems') or '{"problems": []}' elif self.path in ALLOWLIST: # Allowed API Calls - Proxy to Powerwall message = pw.poll(self.path) @@ -494,7 +496,10 @@ def do_GET(self): self.send_header('Content-type','{}'.format(ftype)) self.end_headers() - self.wfile.write(fcontent) + try: + self.wfile.write(fcontent) + except: + log.debug("Socket broken sending PROXY response to client [doGET]") return # Count @@ -519,7 +524,7 @@ def do_GET(self): self.end_headers() self.wfile.write(bytes(message, "utf8")) except: - log.error("Socket broken sending response [doGET]") + log.error("Socket broken sending API response to client [doGET]") with ThreadingHTTPServer((bind_address, port), handler) as server: if(https_mode == "yes"): diff --git a/pypowerwall/__init__.py b/pypowerwall/__init__.py index 821225b..6ae6aa7 100644 --- a/pypowerwall/__init__.py +++ b/pypowerwall/__init__.py @@ -297,7 +297,7 @@ def poll(self, api='/api/site_info/site_name', jsonformat=False, raw=False, recu return None if r.status_code == 404: # API not found or no longer supported - log.debug('ERROR Powerwall API not found at %s' % url) + log.debug('404 Powerwall API not found at %s' % url) return None if r.status_code >= 400 and r.status_code < 500: # Session Expired - Try to get a new one unless we already tried