FIX Issue #114 - Thermostat not reporting on / off properly (90 sec delay)

This commit is contained in:
Jean-Marc Collin
2023-10-08 11:05:04 +02:00
parent ef994e300b
commit 56fdbf4fba

View File

@@ -949,13 +949,16 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
@property @property
def hvac_mode(self) -> HVACMode | None: def hvac_mode(self) -> HVACMode | None:
"""Return current operation.""" """Return current operation."""
if self._is_over_climate: # Issue #114 - returns my current hvac_mode and not the underlying hvac_mode which could be different
# delta will be managed by climate_state_change event.
# TODO remove this when ok
# if self._is_over_climate:
# if one not OFF -> return it # if one not OFF -> return it
# else OFF # else OFF
for under in self._underlyings: # for under in self._underlyings:
if (action := under.hvac_mode) not in [HVACMode.OFF]: # if (mode := under.hvac_mode) not in [HVACMode.OFF]
return action # return mode
return HVACMode.OFF # return HVACMode.OFF
return self._hvac_mode return self._hvac_mode
@@ -1603,7 +1606,8 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
) )
# Issue 99 - some AC turn hvac_mode=cool and hvac_action=idle when sending a HVACMode_OFF command # Issue 99 - some AC turn hvac_mode=cool and hvac_action=idle when sending a HVACMode_OFF command
#if self._hvac_mode == HVACMode.OFF and new_hvac_mode == HVACMode.COOL and new_hvac_action == HVACAction.IDLE: # Issue 114 - Remove this because hvac_mode is now managed by local _hvac_mode and use idle action as is
#if self._hvac_mode == HVACMode.OFF and new_hvac_action == HVACAction.IDLE:
# _LOGGER.debug("The underlying switch to idle instead of OFF. We will consider it as OFF") # _LOGGER.debug("The underlying switch to idle instead of OFF. We will consider it as OFF")
# new_hvac_mode = HVACMode.OFF # new_hvac_mode = HVACMode.OFF