Skip to content

Commit

Permalink
FIX exception when power is not retrieved at first run
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Marc Collin committed Jan 2, 2023
1 parent 95c5cf9 commit bb73228
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/versatile_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,9 @@ async def _async_max_power_changed(self, event):
_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:
Expand Down

0 comments on commit bb73228

Please sign in to comment.