FIX exception when power is not retrieved at first run

This commit is contained in:
Jean-Marc Collin
2023-01-02 15:59:57 +01:00
parent 95c5cf94c2
commit bb7322854e

View File

@@ -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: