mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 13:15:18 +02: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:
committed by
Paulus Schoutsen
parent
589554ad16
commit
dc1534c6d1
@@ -44,6 +44,8 @@ class ISYCoverDevice(ISYDevice, CoverDevice):
|
|||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> int:
|
def current_cover_position(self) -> int:
|
||||||
"""Return the current cover position."""
|
"""Return the current cover position."""
|
||||||
|
if self.is_unknown() or self.value is None:
|
||||||
|
return None
|
||||||
return sorted((0, self.value, 100))[1]
|
return sorted((0, self.value, 100))[1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@@ -31,7 +31,7 @@ class ISYLightDevice(ISYDevice, Light):
|
|||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Get whether the ISY994 light is on."""
|
"""Get whether the ISY994 light is on."""
|
||||||
return self.value > 0
|
return self.value != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def brightness(self) -> float:
|
def brightness(self) -> float:
|
||||||
|
Reference in New Issue
Block a user