Skip to content

Commit

Permalink
Disable node status sensor on node replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
kpine committed Dec 19, 2021
1 parent 9870955 commit d74470b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions homeassistant/components/zwave_js/__init__.py
Expand Up @@ -355,6 +355,11 @@ def async_on_node_removed(event: dict) -> None:
assert device
if replaced:
discovered_value_ids.pop(device.id, None)

async_dispatcher_send(
hass,
f"{DOMAIN}_{client.driver.controller.home_id}.{node.node_id}.node_status_remove_entity",
)
else:
remove_device(device)

Expand Down
7 changes: 7 additions & 0 deletions homeassistant/components/zwave_js/sensor.py
Expand Up @@ -520,4 +520,11 @@ async def async_added_to_hass(self) -> None:
self.async_poll_value,
)
)
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{DOMAIN}_{self.unique_id}_remove_entity",
self.async_remove,
)
)
self.async_write_ha_state()

0 comments on commit d74470b

Please sign in to comment.