Filter out-of-range target temperature sent from underlying climate devices (#581)

* Filter out-of-range temperature from underlying climate

* Fixed broken test case, added new test case for range filtering
This commit is contained in:
Gernot Messow
2024-10-27 09:21:08 +01:00
committed by GitHub
parent fc39cf5f40
commit 60bd522a97
2 changed files with 129 additions and 5 deletions

View File

@@ -719,6 +719,22 @@ class ThermostatOverClimate(BaseThermostat[UnderlyingClimate]):
)
return
# Forget event when the new target temperature is out of range
if (
not new_target_temp is None
and not self._attr_min_temp is None
and not self._attr_max_temp is None
and not (self._attr_min_temp <= new_target_temp <= self._attr_max_temp)
):
_LOGGER.debug(
"%s - underlying sent a target temperature (%s) which is out of configured min/max range (%s / %s). The value will be ignored",
self,
new_target_temp,
self._attr_min_temp,
self._attr_max_temp,
)
return
# A real changes have to be managed
_LOGGER.info(
"%s - Underlying climate %s have changed. new_hvac_mode is %s (vs %s), new_hvac_action=%s (vs %s), new_target_temp=%s (vs %s), new_fan_mode=%s (vs %s)",