Protect against an exception in Shelly climate platform (#77102)
Check if state in HVACMode
This commit is contained in:
parent
8b46174667
commit
e03eb238e2
1 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue