Listen to node events in the zwave_js node status sensor (#55341)
This commit is contained in:
parent
1f37c215f6
commit
714564eaa6
3 changed files with 51 additions and 6 deletions
|
@ -462,6 +462,7 @@ class ZWaveNodeStatusSensor(SensorEntity):
|
|||
"""Poll a value."""
|
||||
raise ValueError("There is no value to poll for this entity")
|
||||
|
||||
@callback
|
||||
def _status_changed(self, _: dict) -> None:
|
||||
"""Call when status event is received."""
|
||||
self._attr_native_value = self.node.status.name.lower()
|
||||
|
@ -480,8 +481,3 @@ class ZWaveNodeStatusSensor(SensorEntity):
|
|||
)
|
||||
)
|
||||
self.async_write_ha_state()
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return entity availability."""
|
||||
return self.client.connected and bool(self.node.ready)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue