diff --git a/homeassistant/components/mqtt/climate.py b/homeassistant/components/mqtt/climate.py index 1c0a2ac2a53..46959f5b6cd 100644 --- a/homeassistant/components/mqtt/climate.py +++ b/homeassistant/components/mqtt/climate.py @@ -792,19 +792,21 @@ class MqttClimate(MqttEntity, ClimateEntity): # Track if we should optimistic update the state optimistic_update = False - if self._away: - optimistic_update = optimistic_update or await self._set_away_mode(False) - elif preset_mode == PRESET_AWAY: + if preset_mode == PRESET_AWAY: + if not self._away: + optimistic_update = await self._set_away_mode(True) or optimistic_update + if self._hold: - await self._set_hold_mode(None) - optimistic_update = optimistic_update or await self._set_away_mode(True) + optimistic_update = await self._set_hold_mode(None) or optimistic_update else: hold_mode = preset_mode if preset_mode == PRESET_NONE: hold_mode = None - optimistic_update = optimistic_update or await self._set_hold_mode( - hold_mode - ) + if self._hold != hold_mode: + optimistic_update = await self._set_hold_mode(hold_mode) or optimistic_update + + if self._away: + optimistic_update = await self._set_away_mode(False) or optimistic_update if optimistic_update: self.async_write_ha_state()