From d4a719a660bf2d6502aa96a0b5676c9edcb159a1 Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Mon, 10 Feb 2025 17:30:05 +0000 Subject: [PATCH] Issue #903 - Modify "follow underlying changes" behavior - Transform 'Auto' hvac_mode to 'Heating' --- .../versatile_thermostat/feature_window_manager.py | 8 ++++---- .../versatile_thermostat/thermostat_climate.py | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/custom_components/versatile_thermostat/feature_window_manager.py b/custom_components/versatile_thermostat/feature_window_manager.py index 6e0049d..dd05a7c 100644 --- a/custom_components/versatile_thermostat/feature_window_manager.py +++ b/custom_components/versatile_thermostat/feature_window_manager.py @@ -130,10 +130,10 @@ class FeatureWindowManager(BaseFeatureManager): async def start_listening(self): """Start listening the underlying entity""" - #Try to get last window bypass state + # Try to get last window bypass state old_state = await self._vtherm.async_get_last_state() - self._is_window_bypass = True if old_state and old_state.attributes and old_state.attributes.get("is_window_bypass") == True else False - + self._is_window_bypass = True if old_state and old_state.attributes and old_state.attributes.get("is_window_bypass") is True else False + if self._is_configured: self.stop_listening() if self._window_sensor_entity_id: @@ -453,7 +453,7 @@ class FeatureWindowManager(BaseFeatureManager): """Set the window bypass flag Return True if state have been changed""" self._is_window_bypass = window_bypass - + if self._window_state == STATE_ON: if not self._is_window_bypass: _LOGGER.info( diff --git a/custom_components/versatile_thermostat/thermostat_climate.py b/custom_components/versatile_thermostat/thermostat_climate.py index 3242af1..76daeef 100644 --- a/custom_components/versatile_thermostat/thermostat_climate.py +++ b/custom_components/versatile_thermostat/thermostat_climate.py @@ -625,6 +625,10 @@ class ThermostatOverClimate(BaseThermostat[UnderlyingClimate]): changes = False new_hvac_mode = new_state.state + # Issue #903 - patch AUTO mode + if new_hvac_mode == HVACMode.AUTO: + new_hvac_mode = HVACMode.HEAT if not self.ac_mode else HVACMode.COOL + old_state = event.data.get("old_state") # Issue #829 - refresh underlying command if it comes back to life