From 88596ff8b46c81841f10dcb3e412a975dfd13acf Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 5 Dec 2024 20:19:40 +0000 Subject: [PATCH 1/2] [bug] - thermostat turn off after restart HA in some conditions Fixes #307 --- config/configuration.yaml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/config/configuration.yaml b/config/configuration.yaml index 2d92148..087fd51 100644 --- a/config/configuration.yaml +++ b/config/configuration.yaml @@ -404,18 +404,28 @@ climate: # target_temp_high: 28.0 - platform: dual_smart_thermostat - name: Edge Case 289 - unique_id: edge_case_289 + name: Edge Case 307 + unique_id: edge_case_307 heater: switch.heater cooler: switch.cooler target_sensor: sensor.room_temp - ac_mode: false - min_temp: 16 - max_temp: 30 - cold_tolerance: 1 - hot_tolerance: 1 - target_temp_step: 0.1 + min_temp: 15 + max_temp: 28 + target_temp: 24 + target_temp_high: 26.5 + target_temp_low: 24 + cold_tolerance: 0.3 + hot_tolerance: 0.3 + min_cycle_duration: + seconds: 5 + away: # this preset will be available for all hvac modes + temperature: 18 + home: # this preset will be available only for heat or cool hvac mode + temperature: 24 precision: 0.1 + target_temp_step: 0.5 + keep_alive: + minutes: 3 # - platform: dual_smart_thermostat # name: Edge Case 210 From c5e61c17e763a7e3c8320324f63dfb3e5a5b46a9 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 11 Dec 2024 09:43:52 +0000 Subject: [PATCH 2/2] fix: thermostat turn off after restart HA in some conditions Fixes #307 --- .../managers/preset_manager.py | 26 ++++++++++++------- .../dual_smart_thermostat/manifest.json | 7 +++-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/custom_components/dual_smart_thermostat/managers/preset_manager.py b/custom_components/dual_smart_thermostat/managers/preset_manager.py index e9e217e..3528788 100644 --- a/custom_components/dual_smart_thermostat/managers/preset_manager.py +++ b/custom_components/dual_smart_thermostat/managers/preset_manager.py @@ -192,16 +192,22 @@ def apply_old_state(self, old_state: State): ) self._environment.saved_target_temp = float(old_temperature) - self._environment.target_temp_low = ( - float(old_target_temp_low) - if old_target_temp_low - else float(preset.to_dict.get(ATTR_TARGET_TEMP_LOW)) - ) - self._environment.target_temp_high = ( - float(old_target_temp_high) - if old_target_temp_high - else float(preset.to_dict.get(ATTR_TARGET_TEMP_HIGH)) - ) + preset_target_temp_low = preset.to_dict.get(ATTR_TARGET_TEMP_LOW) + preset_target_temp_high = preset.to_dict.get(ATTR_TARGET_TEMP_HIGH) + + if preset_target_temp_low is not None: + self._environment.target_temp_low = ( + float(old_target_temp_low) + if old_target_temp_low + else float(preset_target_temp_low) + ) + + if preset_target_temp_high is not None: + self._environment.target_temp_high = ( + float(old_target_temp_high) + if old_target_temp_high + else float(preset_target_temp_high) + ) elif self._preset_modes and old_pres_mode in self._presets: _LOGGER.debug("Restoring previous preset mode target: %s", old_pres_mode) diff --git a/custom_components/dual_smart_thermostat/manifest.json b/custom_components/dual_smart_thermostat/manifest.json index f595d47..310b476 100644 --- a/custom_components/dual_smart_thermostat/manifest.json +++ b/custom_components/dual_smart_thermostat/manifest.json @@ -7,11 +7,14 @@ "dependencies": [ "climate", "sensor", - "switch" + "switch", + "input_select", + "input_boolean", + "input_number" ], "documentation": "https://github.com/swingerman/ha-dual-smart-thermostat.git", "iot_class": "local_polling", "issue_tracker": "https://github.com/swingerman/ha-dual-smart-thermostat/issues", "requirements": [], "version": "v0.9.9" -} +} \ No newline at end of file