Allow to change MQTT climate hold mode (#28988)

This commit is contained in:
Dmitry Krasnoukhov 2019-11-26 06:53:37 +02:00 committed by Paulus Schoutsen
parent 5f4fc271d4
commit 4881bc04d8
2 changed files with 27 additions and 5 deletions

View file

@ -756,12 +756,14 @@ class MqttClimate(
if self._away:
optimistic_update = optimistic_update or self._set_away_mode(False)
elif preset_mode == PRESET_AWAY:
if self._hold:
self._set_hold_mode(None)
optimistic_update = optimistic_update or self._set_away_mode(True)
if self._hold:
optimistic_update = optimistic_update or self._set_hold_mode(None)
elif preset_mode not in (None, PRESET_AWAY):
optimistic_update = optimistic_update or self._set_hold_mode(preset_mode)
else:
hold_mode = preset_mode
if preset_mode == PRESET_NONE:
hold_mode = None
optimistic_update = optimistic_update or self._set_hold_mode(hold_mode)
if optimistic_update:
self.async_write_ha_state()