mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Protect against an exception in Shelly climate platform (#77102)
Check if state in HVACMode
This commit is contained in:
parent
8b46174667
commit
e03eb238e2
@ -188,7 +188,10 @@ class BlockSleepingClimate(
|
||||
def hvac_mode(self) -> HVACMode:
|
||||
"""HVAC current mode."""
|
||||
if self.device_block is None:
|
||||
return HVACMode(self.last_state.state) if self.last_state else HVACMode.OFF
|
||||
if self.last_state and self.last_state.state in list(HVACMode):
|
||||
return HVACMode(self.last_state.state)
|
||||
return HVACMode.OFF
|
||||
|
||||
if self.device_block.mode is None or self._check_is_off():
|
||||
return HVACMode.OFF
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user