From 10eca5b98684508d19abac54f19ca1325ba21c33 Mon Sep 17 00:00:00 2001 From: unaiur Date: Tue, 9 Mar 2021 00:14:24 +0100 Subject: [PATCH] Fix maxcube thermostat transition from off to heat mode (#47643) Transition from HVAC_MODE_OFF to HVAC_MODE_HEAT are not executed because target temperature is kept at OFF_TEMPERATURE, turning it into a no-op. This change ensures that we increase the target temperature to at least the minimum temperature when transitioning to HVAC_MODE_HEAT mode. --- homeassistant/components/maxcube/climate.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/maxcube/climate.py b/homeassistant/components/maxcube/climate.py index c17cc988c1d..5db4cc1e7bd 100644 --- a/homeassistant/components/maxcube/climate.py +++ b/homeassistant/components/maxcube/climate.py @@ -107,7 +107,9 @@ class MaxCubeClimate(ClimateEntity): device = self._cubehandle.cube.device_by_rf(self._rf_address) if device.min_temperature is None: return MIN_TEMPERATURE - return device.min_temperature + # OFF_TEMPERATURE (always off) a is valid temperature to maxcube but not to Home Assistant. + # We use HVAC_MODE_OFF instead to represent a turned off thermostat. + return max(device.min_temperature, MIN_TEMPERATURE) @property def max_temp(self): @@ -155,7 +157,9 @@ class MaxCubeClimate(ClimateEntity): if hvac_mode == HVAC_MODE_OFF: temp = OFF_TEMPERATURE - elif hvac_mode != HVAC_MODE_HEAT: + elif hvac_mode == HVAC_MODE_HEAT: + temp = max(temp, self.min_temp) + else: # Reset the temperature to a sane value. # Ideally, we should send 0 and the device will set its # temperature according to the schedule. However, current