mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix some unhandled exceptions due to missing null checks (#16812)
Fixed a couple cases that would produce errors when the ISY node status was None or `-inf`.
This commit is contained in:
parent
589554ad16
commit
dc1534c6d1
@ -44,6 +44,8 @@ class ISYCoverDevice(ISYDevice, CoverDevice):
|
||||
@property
|
||||
def current_cover_position(self) -> int:
|
||||
"""Return the current cover position."""
|
||||
if self.is_unknown() or self.value is None:
|
||||
return None
|
||||
return sorted((0, self.value, 100))[1]
|
||||
|
||||
@property
|
||||
|
@ -31,7 +31,7 @@ class ISYLightDevice(ISYDevice, Light):
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Get whether the ISY994 light is on."""
|
||||
return self.value > 0
|
||||
return self.value != 0
|
||||
|
||||
@property
|
||||
def brightness(self) -> float:
|
||||
|
Loading…
x
Reference in New Issue
Block a user