Skip to content

Commit

Permalink
Cache 404 Responses
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonacox committed Mar 16, 2024
1 parent b54b4ab commit f3ab78d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# RELEASE NOTES

## v0.7.10 - Cache 404 Responses

* Add cache and extended TTL for 404 responses from Powerwall as identified in issue https://github.com/jasonacox/Powerwall-Dashboard/issues/449. This will help reduce load on Powerwall gateway that may be causing rate limiting for some users (Firmware 23.44.0+).

## v0.7.9 - Cloud Grid Status

* Bug fix for correct grid status for Solar-Only systems on `cloud mode` (see https://github.com/jasonacox/Powerwall-Dashboard/issues/437)
Expand Down
2 changes: 1 addition & 1 deletion proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.10-alpine
WORKDIR /app
RUN pip3 install pypowerwall==0.7.9 bs4
RUN pip3 install pypowerwall==0.7.10 bs4
COPY . .
CMD ["python3", "server.py"]
EXPOSE 8675
6 changes: 4 additions & 2 deletions pypowerwall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
from . import tesla_pb2 # Protobuf definition for vitals
from . import cloud # Tesla Cloud API

version_tuple = (0, 7, 9)
version_tuple = (0, 7, 10)
version = __version__ = '%d.%d.%d' % version_tuple
__author__ = 'jasonacox'

Expand Down Expand Up @@ -296,7 +296,9 @@ def poll(self, api='/api/site_info/site_name', jsonformat=False, raw=False, recu
log.debug('ERROR Unknown error connecting to Powerwall at %s' % url)
return None
if r.status_code == 404:
# API not found or no longer supported
# API not found or no longer supported - cache and increase cache TTL by 10 minutes
self.pwcachetime[api] = time.perf_counter() + 600
self.pwcache[api] = None
log.debug('404 Powerwall API not found at %s' % url)
return None
if r.status_code >= 400 and r.status_code < 500:
Expand Down

0 comments on commit f3ab78d

Please sign in to comment.