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:
Greg Laabs 2018-09-24 02:43:00 -07:00 committed by Paulus Schoutsen
parent 589554ad16
commit dc1534c6d1
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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: