From e604ace8ea9e6e82cef4230a47d21d2d4f608690 Mon Sep 17 00:00:00 2001 From: Ola Lidholm Date: Wed, 4 Sep 2024 08:19:01 +0200 Subject: [PATCH] Added try clause in check_latest_pulse --- custom_components/easee/controller.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/easee/controller.py b/custom_components/easee/controller.py index 78993cc0..c7cca101 100644 --- a/custom_components/easee/controller.py +++ b/custom_components/easee/controller.py @@ -336,7 +336,10 @@ def check_latest_pulse(self): return now = dt_util.utcnow().replace(microsecond=0) - elapsed = now - self.state["latestPulse"] + try: + elapsed = now - self.state["latestPulse"] + except KeyError: + return if elapsed.total_seconds() > OFFLINE_DELAY: if self.state["isOnline"] is True: