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

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

Thanks for your response @troy.
As for changing the “Name” in the GUI, shouldn’t you be able to change the “Name” without having to change the entity name? The built in check should allow you to change the name without having to change the entity too I would think.

As for shutting down HA and z-wave network while making changes, I’ll try to practice the safer method as well. I did try to update the zwcfg*.xml file with a new name and then allow HA to fix the core.entity files but that didn’t work for me. Maybe it’s because i made the changes while it was running (I did restart the whole Pi after the changes though).

but yeah, I’m having a lot of issues with changing entities and names which I thought would be pretty easy. Thanks again! here’s hoping they fix this soon.

Have you noticed how long ago this thread was started?

If they haven’t fixed it by now I wouldn’t hold my breath waiting for a fix.

Well … the thread was started a long time ago but things worked completely different back then (you had to use ozwcp - which might have been a little bit complicated and was outside HA). Then the zwave stuff was rewritten and integrated into HA and that’s when the chaos started IMHO.
The zwave integration as it is today really leaves some room for improvement …

I don’t think you understand the timeline of Z wave integration into HA.

I started using HA in august of 2017. At that time all of the OZWCP functionality had been fully integrated into the z wave control panel of HA (mostly) just as it is now. Over that year from the time I started using HA till the time this thread was started (1 year later) the changes that had been made since then made it more “chaotic”.

After the initial integration, it worked perfectly fine. If you added a new node all you needed to do was go to the Z wave control panel (in HA) and rename the node. After you restarted HA the changes would be reflected in the entities created by that node. Done!

Then the concept of the original “entity_registry” was introduced. That’s when things really started getting overly complicated for the average Z wave HA user.

But it was still workable, tho less convenient, because you could still just rename the node in HA thru the Z wave control panel (in a similar fashion to as it is now - not outside of HA), delete the entity_registry.yaml file, restart HA, a new entity_registry.yaml file would be regenerated from the z wave controller with the new node name included and the changes would be implemented across all entities associated with the renamed z wave device all at one time. There was no need AT ALL to rename, one by one, each individual entity created by the device

Then when the decision was made to completely REMOVE functions from that control panel (namely and most fundamentally critical, the ability to rename nodes) things are where they stand right now.

This whole thread (and many others) has been about ways of coming up with workarounds to a situation that has been imposed on the users by the HA developers themselves.

And since this was intentionally rewritten this way and it’s been going on for so long with NO ONE who has any authority on the subject coming on here (I don’t know if you noticed but this is just one of MANY threads on this topic) and addressing any concerns or explaining why it has to be this way or giving any road map for making it better than it is right now I don’t see any reason to believe there is any interest in “fixing” things.

Your concerns are valid, it certainly seemed easier. But you have to realize that home assistant is in a transition period. The devs are working towards a goal and that goal is to remove naming devices from components and build it in the UI in one place for all components. We are currently in an interim period where we only have half of the pieces to the puzzle. The only remaining piece that is missing is the ability to remove things from the existing entity_registry. So what’s needed for that? A UI that lists all named entities with a x next to each entity_id. I’m sure we’ll see something to that affect in the upcoming year.

Kind of…

Another thing that needs to be done is the ability to rename the base “zwave.xxx” entity (which is created by every z wave device no matter what the functionality is) and have that base entity name propagate down to all of the children entities - “sensor.xxx_alarm”, “sensor.xxx_temperature”, “switch.xxx”, etc.

If that could be done then it would at least get us closer to a similar functionality that we had prior to all of the changes in the last year.

As I’ve noted before there are some devices that add up to 13 entities when the device is added to the network. It’s asinine to require us to rename every entity manually and individually.

And with all of the threads on this you would still think that at least one of the devs might have found some time to come around and say anything (at all) about what the end goal was and the steps that were required to get there and maybe some sort of timeline.

I don’t know if you’ve noticed or not (:wink:) but Z Wave (and Zigbee :roll_eyes:) seems to be one of the “core components” in any viable, successful home automation system. So you would think that there would have been a higher priority in allocating resources to getting this worked out over MANY of the other countless minor components that have been added over the last year.

2 Likes

Thanks for sharing this! been banging my head against the brick wall for days. Only just starting out with Home Assistant, steep learning curve…

Ah yes, that is something that needs to happen. I’m not sure if the devs are aware of that issue. I like many of them no longer have to rename devices. I also tend to ignore the devices I don’t use.