Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of Z-Wave nodes leave orphaned entities/devices behind #18795

Closed
kpine opened this issue Nov 29, 2018 · 18 comments · Fixed by #23633
Closed

Removal of Z-Wave nodes leave orphaned entities/devices behind #18795

kpine opened this issue Nov 29, 2018 · 18 comments · Fixed by #23633

Comments

@kpine
Copy link
Contributor

kpine commented Nov 29, 2018

Home Assistant release with the issue:

0.82.0

Last working Home Assistant release (if known):
Probably when the entity registry was created.

Operating environment (Hass.io/Docker/Windows/etc.):

Linux, RPi3, virtualenv.

Component/platform:

Z-Wave

Description of problem:

There are two related cases, 1) when nodes are removed (excluded) and 2) z-wave controller resets.

In either case, there are orphaned entity IDs and z-wave nodes (devices?) displayed in the Z-Wave Integration panel; all the config entries in .storage are left behind. I'm not sure what would happen if you tried to rename a new entity with one of these.

In the second case, I am theorizing that since entities are mapped via the node ID, if the controller is reset and nodes are included in a different order, it's possible that operating a light switch could turn on a siren, etc. (node 8 used to map to a light entity, but after a controller reset node 9 is a door siren). I don't have any proof of it, but this kind of weird behavior has come up in Discord chat.

Because the entity IDs and devices are stored in the "inaccessible" .storage location, it's not easy for users to get rid of them, and it can be risky to hand modify the JSON. There's also no way in the UI to remove them.

Here's what it looks like when you remove (exclude) nodes (taken from this community post):

image

Additional information:

As a user, I would probably expect a node removal to also remove all the associated entity IDs and devices.

The second issue, controller reset, is a bigger problem but pretty similar. Maybe removing the Z-Wave integration itself should also remove all entities?

I'm not sure if the above suggestions are in-line with the rest of HA behavior, but are just my thoughts.

@cgarwood
Copy link
Member

Removing a node needs to remove associated device from device registry and entities from the entity registry. This is not currently being done.

@jaimevisser
Copy link

Also, when marking an entity as hidden from the z-wave configuration panel (or config files) this leaves the same dead entities.

@cgarwood cgarwood added the core label Dec 17, 2018
@cgarwood
Copy link
Member

The entity and device registry in the core don't have functions to remove entities, so this is a core issue as well, not just zwave.

@zerox1212
Copy link

+1 this is very annoying. Every time I end up editing my network I have to constantly go edit files in .storage which kind of defeats the purpose the UI.

@kriscmore
Copy link

+1 this is very annoying. Every time I end up editing my network I have to constantly go edit files in .storage which kind of defeats the purpose the UI.

I concur! I've been fighting with blank nodes and THIS just allowed me to remove them. THANK YOU!!!

@KennethLavrsen
Copy link

I have had huge issues with this. I have had sensors that were not added correctly (non-secure instead of secure for example because I did not click fast enough on sensor button).
When I re-add the device I cannot name it the same name as before because the device registry still contain all the cruft. I had to hack these files for hours to get back in order.
As a new user in the Home Assistant world anything related to Z-wave has been a nasty experience. Adding and giving devices names is a nightmare. And hacking the data files caused crashes etc because I left a comma too many. Human are not supposed to hack these internal data files. When you actively remove a Z-wave device with the remove feature, the device must also be removed from the databases.

@Twisted7ech
Copy link

Also having issues with this. What is the best way to identify and remove the orphaned entities?

@Swiftnesses
Copy link

+1 on this, as a new user (migrated from another platform), management and naming of z-wave devices is a nightmare. The fact they're not even removed after a failed association is madness.

@TheMrAnderson
Copy link

+1 on this. I had Z-Wave devices that didn't configure right and had to remove the node and readd. I now have not only stale entities, but I have 2 of the same Z-Wave device and one uses the _2 and the other is _7 because of all the failures in between.

@phischmi
Copy link

phischmi commented Apr 9, 2019

I also stumbled upon this issue. Really annoying :/
+1

@djknight90
Copy link

+1 on this issue. Anyone know how to solve it temporarily? I have a ton of orphaned Z-Wave entities. Hitting delete in the UI warns me that it's not actually deleting the entity

@zerox1212
Copy link

You need to sift through the file in .storage and delete the orphaned items.

@derekleeds
Copy link

You need to sift through the file in .storage and delete the orphaned items.

I was able to remove the ghost/misconfigured items. Thanks for the recommendation of looking in the .storage.

For those needing more details.
Open config/.storage/core.device_registry
The ones that I removed were the items were the devices, in my case "Ecolink Door/Window Sensor", that had "area_id" : null. I changed their areas in the "Integration Tab > Z-Wave" so that they could be easily identified.

Success for me.

Thanks again zerox1212.

@brettvitaz
Copy link

brettvitaz commented Apr 28, 2019

I would love to see this solved in an automated way. I am switching out my z-wave usb controller and will have so many orphaned devices that it seems better to just wipe and reinstall the HA server and start fresh.

@matejdro
Copy link
Contributor

Will that MR remove existing nodes or only subsequent deletions?

@cgarwood
Copy link
Member

It will only delete entities for future node removals, it won’t clean up entities from nodes that were already deleted

@darkbasic
Copy link

I'm running 0.97.2 and it doesn't work for me :(

@balloob
Copy link
Member

balloob commented Aug 20, 2019

Please open a new issue.

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.