From bb7322854ec62cfeab3db71cf3fe7579539ecc0b Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Mon, 2 Jan 2023 15:59:57 +0100 Subject: [PATCH] FIX exception when power is not retrieved at first run --- custom_components/versatile_thermostat/climate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/versatile_thermostat/climate.py b/custom_components/versatile_thermostat/climate.py index 404b54f..d1a08b1 100644 --- a/custom_components/versatile_thermostat/climate.py +++ b/custom_components/versatile_thermostat/climate.py @@ -810,7 +810,9 @@ class VersatileThermostat(ClimateEntity, RestoreEntity): _LOGGER.debug(event) new_state = event.data.get("new_state") old_state = event.data.get("old_state") - if new_state is None or new_state.state == old_state.state: + if new_state is None or ( + old_state is not None and new_state.state == old_state.state + ): return try: