From 410a7430c6237b42a3cd088c811c5f44e89e2610 Mon Sep 17 00:00:00 2001 From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com> Date: Tue, 4 Jun 2024 09:52:00 +0100 Subject: [PATCH] Catch another web-socket error (#1174) * Catch another web-socket error * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- apps/predbat/predbat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/predbat/predbat.py b/apps/predbat/predbat.py index 191dc3ec..20613890 100644 --- a/apps/predbat/predbat.py +++ b/apps/predbat/predbat.py @@ -36,7 +36,7 @@ if not "PRED_GLOBAL" in globals(): PRED_GLOBAL = {} -THIS_VERSION = "v7.22.0" +THIS_VERSION = "v7.22.1" PREDBAT_FILES = ["predbat.py"] TIME_FORMAT = "%Y-%m-%dT%H:%M:%S%z" TIME_FORMAT_SECONDS = "%Y-%m-%dT%H:%M:%S.%f%z" @@ -15556,7 +15556,7 @@ async def socketLoop(self): if new_state: self.update_state_item(new_state) # Only trigger on value change or you get too many updates - if new_state.get("state", None) != old_state.get("state", None): + if not old_state or (new_state.get("state", None) != old_state.get("state", None)): await self.base.trigger_watch_list( new_state["entity_id"], event_data.get("attribute", None), event_data.get("old_state", None), new_state )