Handle missing value in all platforms of zwave_js (#46081)

This commit is contained in:
Marcel van der Veldt 2021-02-06 14:02:03 +01:00 committed by GitHub
parent fb68bf85ae
commit 242ff045b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 14 deletions

View file

@ -102,13 +102,7 @@ class ZWaveBaseEntity(Entity):
@property
def available(self) -> bool:
"""Return entity availability."""
return (
self.client.connected
and bool(self.info.node.ready)
# a None value indicates something wrong with the device,
# or the value is simply not yet there (it will arrive later).
and self.info.primary_value.value is not None
)
return self.client.connected and bool(self.info.node.ready)
@callback
def _value_changed(self, event_data: dict) -> None: