From 313fa261609794cb97f8dcb8fa090e124eae35c4 Mon Sep 17 00:00:00 2001 From: adi90x Date: Mon, 10 Feb 2025 17:29:53 +0100 Subject: [PATCH] Save & Recover Window Bypass state (#898) * Remove windows_bypass state from unrecorded * Recover bypass_state --- .../versatile_thermostat/feature_window_manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/versatile_thermostat/feature_window_manager.py b/custom_components/versatile_thermostat/feature_window_manager.py index 24d809b..6d19cc1 100644 --- a/custom_components/versatile_thermostat/feature_window_manager.py +++ b/custom_components/versatile_thermostat/feature_window_manager.py @@ -44,7 +44,6 @@ class FeatureWindowManager(BaseFeatureManager): { "window_sensor_entity_id", "is_window_configured", - "is_window_bypass", "window_delay_sec", "window_off_delay_sec", "window_auto_configured", @@ -130,6 +129,11 @@ class FeatureWindowManager(BaseFeatureManager): @overrides async def start_listening(self): """Start listening the underlying entity""" + + #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 + if self._is_configured: self.stop_listening() if self._window_sensor_entity_id: