mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
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.
This commit is contained in:
parent
512ef2fce4
commit
b8fa5367db
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user