What is the preferred way to rename z-wave entities?

I’m now in this boat too, trying to set up a new house I currently need to rename 3 plugs, each plug has 10 entities, and I have more plugs/switches coming. Renaming them one by one is just insane… This is exactly what computers are supposed to be for. Is there any chance this will actually get fixed?

@Tinkerer might be able to triage to the relevant party?

Not really, I’ve raised it before.

However, maybe somebody could open a feature request in the feature requests section of the forum?

I’v now also realised that old entities that have been succesfully removed from the zwave network no longer get removed from the list…

What list are you referring to?

The Zwave integration list. It shows the old namesitems with a bunvh of “entity unavailable” messages.

are they present inside your openzwave config file?

They are present in some, but frankly there’s been so many changes that I don’t know anymore which one is “leading” (most of them have been automatically generated). I’ve removed all configuration options from my main configuration except where the antenna is and removed my device_config and device_config_glob, but that doesn’t seem to have any effect.

Ok, I’m still unclear which list you are talking about. Is it this list:

EDIT: I’m only trying to clarify because zwave integration list is meaningless as it matches no named lists in HA.

No it’s the list under Configuration -> Integrations -> Zwave.
Which as far as I’ve understood should now be the main way to change entity names. They are not present as a node anymore, they’ve been succesfully removed.

Oh, that must be new. That’s going to be somewhere in .storage, which is a hidden folder inside your config directory.

be warned, editing those files is dangerous if you don’t know/understand json.

Yeah, I’ve seen those and it looks like this’ll be the only way to handle zwave for the time being going by this and other threads. It looks like removing nodes is another regression besides renaming…

I’m not sure why they haven’t deployed a way to remove entities from the entity registry. My guess is that’s your problem. core.entity_registry. Back up this file, shut down home assistant. Then do the following to remove an entity you don’t want:

{
    "data": {
        "entities": [
            { #highlight this line
                "config_entry_id": null,
                "device_id": null,
                "disabled_by": null,
                "entity_id": "light.z",
                "name": "z",
                "platform": "a",
                "unique_id": "tyertyertyertyertyrety"
            }, #to this line and delete.
            {
                "config_entry_id": null,
                "device_id": null,
                "disabled_by": null,
                "entity_id": "light.y",
                "name": "y",
                "platform": "a",
                "unique_id": "ghjkghjkghjkghjkghjkghjkghjkghjkghjk"
            },
            {
                "config_entry_id": null,
                "device_id": null,
                "disabled_by": null,
                "entity_id": "switch.x",
                "name": "x",
                "platform": "b",
                "unique_id": "asdfasdfasdfasdfasdfasdfasdfasdf"
            }
        ]
    },
    "key": "core.entity_registry",
    "version": 1
}

you will end up with this:

{
    "data": {
        "entities": [
            {
                "config_entry_id": null,
                "device_id": null,
                "disabled_by": null,
                "entity_id": "light.y",
                "name": "y",
                "platform": "a",
                "unique_id": "ghjkghjkghjkghjkghjkghjkghjkghjkghjk"
            },
            {
                "config_entry_id": null,
                "device_id": null,
                "disabled_by": null,
                "entity_id": "switch.x",
                "name": "x",
                "platform": "b",
                "unique_id": "asdfasdfasdfasdfasdfasdfasdfasdf"
            }
        ]
    },
    "key": "core.entity_registry",
    "version": 1
}

if you delete the last item inside the entities collection (switch.x in the example). Then you need to remove the comma from the previous item (which would be light.y):

{
    "data": {
        "entities": [
            {
                "config_entry_id": null,
                "device_id": null,
                "disabled_by": null,
                "entity_id": "light.y",
                "name": "y",
                "platform": "a",
                "unique_id": "ghjkghjkghjkghjkghjkghjkghjkghjkghjk"
            }, # remove this comma if you delete last item.
            { # last item start (delete start)
                "config_entry_id": null,
                "device_id": null,
                "disabled_by": null,
                "entity_id": "switch.x",
                "name": "x",
                "platform": "b",
                "unique_id": "asdfasdfasdfasdfasdfasdfasdfasdf"
            } # last item end. (delete end)
        ] # this signifies the end of the collection. (Don't delete this)
    },
    "key": "core.entity_registry",
    "version": 1
}
4 Likes

Thanks, looks like I also had to remove them from the device registry, but at least they are gone now. Sadly now there’s a bunch of entities for other nodes there as well that were previously hidden because I removed the device_config.yaml for testing. Now I’ll have to remove those as well.

At least that confirms that they are not deleted for some reason. I really wished they’d actually tested this change before implementing it…

1 Like

I just switched from the Aeotec Gen 5 to the HUSBZB-1 so I basically reconfigured my whole z-wave network from scratch. I didn’t realize how much I really missed renaming nodes from the HA OZW config.

I know this is not recommended but I found editing zwcfg*.xml to be the quickest and most constant way to rename all my devices because I only had to do it one time per device in one location

Thanks @David_L I followed your steps and this worked for me as well

And I’m just gonna say having to manually edit zwcfg*.xml was not difficult but then dealing with these core.entity_registry and core.device_registry files certainly added a thorn in my side. I just ended up deleting them letting HA generate new ones

Z-wave integration was much better before the lastest changes.
I am also struggling with removing a dead device. I was able to re-add it, so it got a new device ID and renaming is a pain.
@troy: is renaming the device in zwcfg*.xml sufficient? Or do we have to registry files as well?

@tmeringer YES!

I just had to deal a little of everything when I switched hubs because I also moved some switches around, replaced a few others and added some new ones as well. Removing dead nodes is one thing but even after you get it removed from the HA GUI it still remains in both the core.entity_registry and core.device_registry. So when you try to just rename your new device to replace the old you get an error! I found out the same is true even if you properly remove a node before it’s even dead. Unfortunately I don’t see anyway around having to edit all 3 files.

In my case with switching hubs and so many other changes all at once, I figured out pretty quick I had real mess on my hands so I just deleted both the core.entity_registry and core.device_registry files. Then let HA generate new files entirely which also worked just fine but that should only be considered as a last resort.

I am only (re)naming my nodes using the zwcfg*.xml
Then I’m deleting the node and its entities from both core.entity_registry and core.device_registry files after reboot HA just adds it back with my desired name.



Just putting together what @David_L and @petro have said here’s how I’m renaming devices. In this case its a new switch I have just added and I want the name to be Entrance Light

The name could be anything. This switch has the generic node name inovelli_nzw30_smart_switch_wscene and I know from the HA GUI that this is node: 12


First thing is to stop Home Assistant

Next I edit the zwcfg*.xml file.
I am only changing name="" in the first line for each node. In this case it’s node: 12
image


Then, following petro’s detailed instructions, I delete the node and all it’s entities from both core.device_registry and core.entity_registry files:

core.device_registry

            {
                "config_entries": [
                    "3d5b603210024a2889f548800xxxxxxx"
                ],
                "connections": [],
                "hub_device_id": null,
                "id": "bb0232d35b8b4b66000xxxxxxxxxxxxx",
                "identifiers": [
                    [
                        "zwave",
                        12
                    ]
                ],
                "manufacturer": "Inovelli",
                "model": "NZW30 Smart Switch (w/Scene)",
                "name": "Inovelli NZW30 Smart Switch (w/Scene)",
                "sw_version": null
            }

core.entity_registry

            {
                "config_entry_id": null,
                "device_id": null,
                "disabled_by": null,
                "entity_id": "zwave.inovelli_nzw30_smart_switch_wscene",
                "name": null,
                "platform": "zwave",
                "unique_id": "node-12"
            },
            {
                "config_entry_id": "3d5b603210024a2889f5488vvvvvvvvv",
                "device_id": "bb0232d35b8b4b66bd70kkkkkkkkkkkk",
                "disabled_by": null,
                "entity_id": "switch.inovelli_nzw30_smart_switch_wscene_switch",
                "name": null,
                "platform": "zwave",
                "unique_id": "12-72057594000000000"
            }

Finally restart Home Assistant

8 Likes

I’m glad I found this thread.
I’m just starting with HASS.io and ran into this problem. It was pretty frustrating to figure out what was going on. I also just found that changing the friendly name “Name” through the GUI doesn’t work as expected either. Per: customizing-devices you’re supposed to be able to change the name or entity ID but if I just try to change the “Name” i get an error that says the entity already exists. So to change the “Name” i have to also change the entity ID to something new, save it, then change it back again, or go to the entity files to add the friendly names which sounds much easier.

In regard to changing the core.entity_registry why do you have to stop HA first? what happens if you don’t?

@techoguy

You’ll get that error because the entity name (still) exists the core.entity_registry file

This is a real problem and it’s extremely frustrating with z-wave devices in particular. It seems like HA never completely removes devices from the core.***.registry files. This created a huge pain for me while moving multiple devices around and just trying to rename them to match there new location. I could not figure out any way from the GUI to reuse any previous name for the new replacement devices which lead me to this thread and eventually to method I summarized above.

I’m always gonna try error on the side of caution when I’m posting some how-to-do something. But personally nothing so far. I make changes to the core.entity_registry file with HA running but you still need reboot for changes to apply. I think it’s a risk to edit with HA running because you’re not supposed to edit these files but hand. (Another reason I just delete the unwanted entry rather then edit to fix it)

And I’ve always read that you need stop you’re z-wave network before editing the zwcfg*.xml file. I don’t know what could happen but maybe I’ve been lucky nothing has. I still can’t say with 100% certainty that nothing ever will or won’t happen. I suppose worst case would be something that causes the need for a complete re-install or basically a “factory reset” of you HA and/or z-wave network. That would suck if something a simple as stopping HA first could have avoided it