Skip to content

Commit 95c5cf9

Browse files
author
Jean-Marc Collin
committed
FIX exception when temperature state is not retrieved
FIX start heating for 0 sec
1 parent 2111976 commit 95c5cf9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

custom_components/versatile_thermostat/climate.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,9 @@ async def _async_power_changed(self, event):
789789
_LOGGER.debug(event)
790790
new_state = event.data.get("new_state")
791791
old_state = event.data.get("old_state")
792-
if new_state is None or new_state.state == old_state.state:
792+
if new_state is None or (
793+
old_state is not None and new_state.state == old_state.state
794+
):
793795
return
794796

795797
try:
@@ -896,7 +898,7 @@ async def _async_control_heating(self, time=None):
896898
self._async_cancel_cycle = None
897899
await self._async_heater_turn_off()
898900

899-
if self._hvac_mode == HVAC_MODE_HEAT:
901+
if self._hvac_mode == HVAC_MODE_HEAT and on_time_sec > 0:
900902
_LOGGER.info(
901903
"%s - start heating for %d min %d sec ",
902904
self,

0 commit comments

Comments
 (0)