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
|
# Track if we should optimistic update the state
|
||||||
optimistic_update = False
|
optimistic_update = False
|
||||||
|
|
||||||
if self._away:
|
if preset_mode == PRESET_AWAY:
|
||||||
optimistic_update = optimistic_update or await self._set_away_mode(False)
|
if not self._away:
|
||||||
elif preset_mode == PRESET_AWAY:
|
optimistic_update = await self._set_away_mode(True) or optimistic_update
|
||||||
|
|
||||||
if self._hold:
|
if self._hold:
|
||||||
await self._set_hold_mode(None)
|
optimistic_update = await self._set_hold_mode(None) or optimistic_update
|
||||||
optimistic_update = optimistic_update or await self._set_away_mode(True)
|
|
||||||
else:
|
else:
|
||||||
hold_mode = preset_mode
|
hold_mode = preset_mode
|
||||||
if preset_mode == PRESET_NONE:
|
if preset_mode == PRESET_NONE:
|
||||||
hold_mode = None
|
hold_mode = None
|
||||||
optimistic_update = optimistic_update or await self._set_hold_mode(
|
if self._hold != hold_mode:
|
||||||
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:
|
if optimistic_update:
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
Reference in New Issue
Block a user