home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.94k stars 29.03k forks source link

OZW: Removing a node does not remove the device from the integration #37466

Closed steve28 closed 4 years ago

steve28 commented 4 years ago

The problem

Nodes removed from the z-wave network leave orphaned devices in the integration. The nodes are completely gone from from the MQTT broker, but the device is still listed in HA under devices as belonging to the OpenZWave integration. There appears to be no way to remove a device.

Environment

Problem-relevant configuration.yaml

N/A

Traceback/Error logs

N/A

Additional information

probot-home-assistant[bot] commented 4 years ago

Hey there @cgarwood, @marcelveldt, @martinhjelmare, mind taking a look at this issue as its been labeled with an integration (ozw) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

MartinHjelmare commented 4 years ago

How was the node removed from the network? Did you exclude the node by calling the ozw.remove_node service and performing the device specific maneuver?

steve28 commented 4 years ago

I actually removed two nodes, but I did them both via MQTT with removefailednode - was chatting with @firstof9 and this is likely the issue. Maybe should update the title to "removefailednode does not remove device entry from HA"?

firstof9 commented 4 years ago

I'm thinking this line in __init__.py isn't detecting the removefailednode event perhaps?

marcelveldt commented 4 years ago

I'm thinking this line in __init__.py isn't detecting the removefailednode event perhaps?

Correct, that can be expanded with removefailednode

marcelveldt commented 4 years ago

Confirmed, this is indeed because you removed the nodes with the "removefailednode" command. There is no "mailbox" function or whatsoever to detect node removals so we're actually watching the removenode command before we actually remove a device with entities from the integration. I'll push a PR to fix this behaviour.