Skip to content

Commit 326cf1b

Browse files
authored
feat: add more update triggers for newer firmware (#206)
* feat: add more update triggers for newer firmware * formatting * order of operations * cleanup * comments
1 parent 99da40d commit 326cf1b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

openevsehttp/__main__.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@
4949

5050
ERROR_TIMEOUT = "Timeout while updating"
5151
INFO_LOOP_RUNNING = "Event loop already running, not creating new one."
52+
UPDATE_TRIGGERS = [
53+
"config_version",
54+
"claims_version",
55+
"override_version",
56+
"schedule_version",
57+
"schedule_plan_version",
58+
"limit_version",
59+
]
5260

5361

5462
class OpenEVSE:
@@ -141,6 +149,7 @@ async def send_command(self, command: str) -> tuple:
141149

142150
async def update(self) -> None:
143151
"""Update the values."""
152+
# TODO: add addiontal endpoints to update
144153
urls = [f"{self.url}config"]
145154

146155
if not self._ws_listening:
@@ -233,9 +242,11 @@ def _update_status(self, msgtype, data, error):
233242

234243
elif msgtype == "data":
235244
_LOGGER.debug("Websocket data: %s", data)
236-
if "wh" in data.keys():
245+
keys = data.keys()
246+
if "wh" in keys:
237247
data["watthour"] = data.pop("wh")
238-
if "config_version" in data.keys():
248+
# TODO: update specific endpoints based on _version prefix
249+
if any(key in keys for key in UPDATE_TRIGGERS):
239250
self.update()
240251
self._status.update(data)
241252

0 commit comments

Comments
 (0)