Skip to content

Commit

Permalink
feat : log message for stall recovery
Browse files Browse the repository at this point in the history
Fixes #295
  • Loading branch information
= authored and swingerman committed Oct 29, 2024
1 parent cde4270 commit 70ccbc5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions custom_components/dual_smart_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 70ccbc5

Please sign in to comment.