mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Guard for missing value (#45867)
* guard for missing value * update comment
This commit is contained in:
parent
c93fec34b3
commit
2e98cfb9ab
@ -92,7 +92,13 @@ class ZWaveBaseEntity(Entity):
|
|||||||
@property
|
@property
|
||||||
def available(self) -> bool:
|
def available(self) -> bool:
|
||||||
"""Return entity availability."""
|
"""Return entity availability."""
|
||||||
return self.client.connected and bool(self.info.node.ready)
|
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
|
||||||
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _value_changed(self, event_data: dict) -> None:
|
def _value_changed(self, event_data: dict) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user