From b8fa5367dbbdb2d11f1a0563535e9229b4749025 Mon Sep 17 00:00:00 2001 From: Nash Kaminski Date: Sat, 2 Nov 2019 04:51:30 -0500 Subject: [PATCH] Fix inability to transition between specific presets in Venstar component (#28238) This change addresses a bug where one is unable to change directly between the away and temperature hold presets, as temperature hold cannot be enabled on a Venstar thermostat if away mode is active. Furthermore, this change removes redundant state checks as the set_away and set_schedule calls are idempotent in the venstarcolortouch library. See https://github.com/hpeyerl/venstar_colortouch/blob/master/src/venstarcolortouch/venstarcolortouch.py#L275. --- homeassistant/components/venstar/climate.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/venstar/climate.py b/homeassistant/components/venstar/climate.py index 9e5450addc5..c948772197f 100644 --- a/homeassistant/components/venstar/climate.py +++ b/homeassistant/components/venstar/climate.py @@ -247,6 +247,7 @@ class VenstarThermostat(ClimateDevice): return PRESET_AWAY if self._client.schedule == 0: return HOLD_MODE_TEMPERATURE + return PRESET_NONE @property def preset_modes(self): @@ -332,13 +333,11 @@ class VenstarThermostat(ClimateDevice): if preset_mode == PRESET_AWAY: success = self._client.set_away(self._client.AWAY_AWAY) elif preset_mode == HOLD_MODE_TEMPERATURE: - success = self._client.set_schedule(0) + success = self._client.set_away(self._client.AWAY_HOME) + success = success and self._client.set_schedule(0) elif preset_mode == PRESET_NONE: - success = False - if self._client.away: - success = self._client.set_away(self._client.AWAY_HOME) - if self._client.schedule == 0: - success = success and self._client.set_schedule(1) + success = self._client.set_away(self._client.AWAY_HOME) + success = success and self._client.set_schedule(1) else: _LOGGER.error("Unknown hold mode: %s", preset_mode) success = False