From 70ccbc573db96b07c10116e0e1b1e011cc8e37b4 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 29 Oct 2024 20:54:05 +0000 Subject: [PATCH] feat : log message for stall recovery Fixes #295 --- custom_components/dual_smart_thermostat/climate.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/custom_components/dual_smart_thermostat/climate.py b/custom_components/dual_smart_thermostat/climate.py index 393815a..cba6a2e 100644 --- a/custom_components/dual_smart_thermostat/climate.py +++ b/custom_components/dual_smart_thermostat/climate.py @@ -423,6 +423,8 @@ def __init__( self._sensor_stale_duration = sensor_stale_duration self._remove_stale_tracking: Callable[[], None] | None = None self._remove_humidity_stale_tracking: Callable[[], None] | None = None + self._sensor_stalled = False + self._humidity_sensor_stalled = False # environment self._temp_precision = precision @@ -970,6 +972,9 @@ async def _async_sensor_changed( return if self._sensor_stale_duration: + if self._sensor_stalled: + self._sensor_stalled = False + _LOGGER.info("Temperature sensor recovered with state: %s", new_state) if self._remove_stale_tracking: self._remove_stale_tracking() self._remove_stale_tracking = async_track_time_interval( @@ -1012,6 +1017,7 @@ async def _async_humidity_sensor_not_responding( now - state.last_updated if now and state else "---", ) _LOGGER.warning("Humidity Sensor is stalled, call the emergency stop") + self._humudity_sensor_stalled = True if self._is_device_active: await self.hvac_device.async_turn_off() self._hvac_action_reason = HVACActionReason.HUMIDITY_SENSOR_STALLED @@ -1073,6 +1079,9 @@ async def _async_sensor_humidity_changed( return if self._sensor_stale_duration: + if self._humidity_sensor_stalled: + self._humidity_sensor_stalled = False + _LOGGER.info("Humidity sensor recovered with state: %s", new_state) if self._remove_humidity_stale_tracking: self._remove_humidity_stale_tracking() self._remove_humidity_stale_tracking = async_track_time_interval(