From 853477a3903435aafe31383b3224851a1bb18cd0 Mon Sep 17 00:00:00 2001 From: = <=> Date: Fri, 18 Oct 2024 09:00:21 +0000 Subject: [PATCH] fix: oly applies max_floor_temp old state if not set from config Fixes #297 --- custom_components/dual_smart_thermostat/climate.py | 2 ++ .../hvac_controller/heater_controller.py | 1 + .../dual_smart_thermostat/managers/environment_manager.py | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/custom_components/dual_smart_thermostat/climate.py b/custom_components/dual_smart_thermostat/climate.py index 91cffa8..393815a 100644 --- a/custom_components/dual_smart_thermostat/climate.py +++ b/custom_components/dual_smart_thermostat/climate.py @@ -453,6 +453,8 @@ def __init__( self._temp_lock = asyncio.Lock() + _LOGGER.name = __name__ + "." + self.unique_id if self.unique_id else __name__ + async def async_added_to_hass(self) -> None: """Run when entity about to be added.""" await super().async_added_to_hass() diff --git a/custom_components/dual_smart_thermostat/hvac_controller/heater_controller.py b/custom_components/dual_smart_thermostat/hvac_controller/heater_controller.py index aae523b..0176464 100644 --- a/custom_components/dual_smart_thermostat/hvac_controller/heater_controller.py +++ b/custom_components/dual_smart_thermostat/hvac_controller/heater_controller.py @@ -61,6 +61,7 @@ async def async_control_device_when_on( is_floor_cold = self._environment.is_floor_cold _LOGGER.debug("_async_control_device_when_on, floor cold: %s", is_floor_cold) + _LOGGER.debug("_async_control_device_when_on, floor hot: %s", is_floor_hot) _LOGGER.debug("_async_control_device_when_on, too_hot: %s", too_hot) if ((too_hot or is_floor_hot) or any_opening_open) and not is_floor_cold: diff --git a/custom_components/dual_smart_thermostat/managers/environment_manager.py b/custom_components/dual_smart_thermostat/managers/environment_manager.py index adb460d..964c2a4 100644 --- a/custom_components/dual_smart_thermostat/managers/environment_manager.py +++ b/custom_components/dual_smart_thermostat/managers/environment_manager.py @@ -820,6 +820,9 @@ def apply_old_state(self, old_state: State) -> None: self._target_temp = float(old_target) + # do we actually need this? self._max_floor_temp = ( - old_state.attributes.get("max_floor_temp") or DEFAULT_MAX_FLOOR_TEMP + (old_state.attributes.get("max_floor_temp") or DEFAULT_MAX_FLOOR_TEMP) + if self._max_floor_temp is None + else self._max_floor_temp )