Handle UPS disconnects in NUT (#35758)

This commit is contained in:
J. Nick Koston 2020-05-18 09:23:05 -05:00 committed by GitHub
parent affd11b372
commit 50105eed74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -189,6 +189,8 @@ class NUTSensor(Entity):
@property
def state(self):
"""Return entity state from ups."""
if not self._data.status:
return None
if self._type == KEY_STATUS_DISPLAY:
return _format_display_state(self._data.status)
return self._data.status.get(self._type)