From 5997a26c73ad2240159abe5894ecf1b453d62bce Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Sun, 23 Jul 2023 09:08:56 +0200 Subject: [PATCH] FIX #90 WarCOzes remark --- custom_components/versatile_thermostat/climate.py | 4 ++++ custom_components/versatile_thermostat/config_flow.py | 6 +++--- custom_components/versatile_thermostat/underlyings.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/custom_components/versatile_thermostat/climate.py b/custom_components/versatile_thermostat/climate.py index b1f9f7a..8bf65a5 100644 --- a/custom_components/versatile_thermostat/climate.py +++ b/custom_components/versatile_thermostat/climate.py @@ -1215,6 +1215,10 @@ class VersatileThermostat(ClimateEntity, RestoreEntity): await under.set_hvac_mode(hvac_mode) or need_control_heating ) + # If AC is on maybe we have to change the temperature in force mode + if self._ac_mode: + await self._async_set_preset_mode_internal(self._attr_preset_mode, True) + if need_control_heating and sub_need_control_heating: await self._async_control_heating(force=True) diff --git a/custom_components/versatile_thermostat/config_flow.py b/custom_components/versatile_thermostat/config_flow.py index 2de1dda..34b678f 100644 --- a/custom_components/versatile_thermostat/config_flow.py +++ b/custom_components/versatile_thermostat/config_flow.py @@ -550,7 +550,7 @@ class VersatileThermostatBaseConfigFlow(FlowHandler): """Handle the presence management flow steps""" _LOGGER.debug("Into ConfigFlow.async_step_presence user_input=%s", user_input) - if self._infos[CONF_AC_MODE]: + if self._infos.get(CONF_AC_MODE) == True: schema = self.STEP_PRESENCE_WITH_AC_DATA_SCHEMA else: schema = self.STEP_PRESENCE_DATA_SCHEMA @@ -689,7 +689,7 @@ class VersatileThermostatOptionsFlowHandler( elif self._infos[CONF_USE_PRESENCE_FEATURE]: next_step = self.async_step_presence - if self._infos[CONF_AC_MODE]: + if self._infos.get(CONF_AC_MODE) == True: schema = self.STEP_PRESETS_WITH_AC_DATA_SCHEMA else: schema = self.STEP_PRESETS_DATA_SCHEMA @@ -752,7 +752,7 @@ class VersatileThermostatOptionsFlowHandler( "Into OptionsFlowHandler.async_step_presence user_input=%s", user_input ) - if self._infos[CONF_AC_MODE]: + if self._infos.get(CONF_AC_MODE) == True: schema = self.STEP_PRESENCE_WITH_AC_DATA_SCHEMA else: schema = self.STEP_PRESENCE_DATA_SCHEMA diff --git a/custom_components/versatile_thermostat/underlyings.py b/custom_components/versatile_thermostat/underlyings.py index 3efd375..00ac87b 100644 --- a/custom_components/versatile_thermostat/underlyings.py +++ b/custom_components/versatile_thermostat/underlyings.py @@ -180,7 +180,7 @@ class UnderlyingSwitch(UnderlyingEntity): if hvac_mode == HVACMode.OFF: if self.is_device_active: await self.turn_off() - await self._cancel_cycle() + self._cancel_cycle() if self._hvac_mode != hvac_mode: self._hvac_mode = hvac_mode