mirror of
https://github.com/home-assistant/core.git
synced 2025-08-07 14:45:09 +02:00
Fixed setting a hold mode when away mode is on
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user