Fix maxcube temperature for thermostat auto mode (#48047)

maxcube-api dependency now supports using None as the
target temperature: in that case, it uses the scheduled
temperature in auto mode and current temperature in all
other modes.

We will use that feature when changing hvac_mode to auto and
selecting PRESET_NONE.
This commit is contained in:
unaiur 2021-03-22 13:13:06 +01:00 committed by GitHub
parent b7ad5ff032
commit 3fb323b745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,13 +160,7 @@ class MaxCubeClimate(ClimateEntity):
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
# version of the library has a bug which causes an
# exception when setting values below 8.
if temp in [OFF_TEMPERATURE, ON_TEMPERATURE]:
temp = device.eco_temperature
temp = None
mode = MAX_DEVICE_MODE_AUTOMATIC
cube = self._cubehandle.cube
@ -264,7 +258,7 @@ class MaxCubeClimate(ClimateEntity):
def set_preset_mode(self, preset_mode):
"""Set new operation mode."""
device = self._cubehandle.cube.device_by_rf(self._rf_address)
temp = device.target_temperature
temp = None
mode = MAX_DEVICE_MODE_AUTOMATIC
if preset_mode in [PRESET_COMFORT, PRESET_ECO, PRESET_ON]: