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
71.11k stars 29.79k forks source link

zwave renaming is now a mess in 0.63 #12430

Closed moskovskiy82 closed 6 years ago

moskovskiy82 commented 6 years ago

Before 0.63 you just added a node. Renamed it. Restarted and the entity was renamed and all of the zwave sensors of this node were renamed as well. As an example. Take fibaro dimmer 2 and rename it to zwave_entrance. Before we then got light.zwave_entrance sensor.zwave_entrance_alarm_level and so on.

Now the renaming doesn't take place. Instead in the entities (/dev-state) it shows up as light.level with the following data light.level off node_id: 15 value_index: 0 value_instance: 2 value_id: 144115188332331009 old_entity_id: light.zwave_entrance_level_15_0_2 new_entity_id: light.zwave_entrance_level friendly_name: zwave_entrance Level supported_features: 33

Although it does display correctly in the frontend. But looking at the sensor entities - complete mess

light.level: platform: zwave unique_id: 15-xx sensor.unknown: platform: zwave unique_id: 15-xx sensor.alarm_type: platform: zwave unique_id: 15-xx sensor.alarm_level: platform: zwave unique_id: 15-xx light.fibaro_system_fgd212_dimmer_2_level: platform: zwave unique_id: 15-xx

Seems this is due to the new entity_id engine introduced recently @balloob ?

cgarwood commented 6 years ago

Yeah, once the entites are added to the new entity registry, renaming the zwave node does not update the entity IDs.

Technically, that's why the entity registry exists, so the entity_id's stay the same. But this behavior is not optimal for zwave devices when you are first adding and naming a device. Not sure what the best way to correct it would be. Maybe a checkbox on the rename node option to regenerate entity_ids?

happyleavesaoc commented 6 years ago

Also, the unique IDs are only unique for a given inclusion. If you have to exclude and re-include your device, all your entity registry entries for that device are useless.

moskovskiy82 commented 6 years ago

A checkbox sound great!

moskovskiy82 commented 6 years ago

Is there any workaround for the moment? Manual renaming? Please post solution here https://community.home-assistant.io/t/renaming-zwave-nodes-after-0-63/43434

balloob commented 6 years ago

From an entity perspective this is working as intended. We are giving the same entity id each time. To change the registered entity id, you can update the entity_registry.yaml file.

Adding a checkbox to regenerate entity ID is also a good idea👍

DubhAd commented 6 years ago

IMO the Rename Node service needs updated to interact with the entity registry correctly (no tick box - it should just work). Requiring people to know to enable a tickbox so that the service works is likely to lead to (more) frustration and confusion.

KingJ commented 6 years ago

I ran in to this issue a short while ago and couldn't figure out why the old entity name was being used in some places (e.g. automation triggers, services dev tools) and the new entity name was being used in other places (e.g. HA dashboard). An option to regenerate the ID, or even automatically updating the ID would be extremely useful.

https://community.home-assistant.io/t/home-assistant-using-previous-entity-id-for-automations-after-device-rename/43570

moskovskiy82 commented 6 years ago

Totally agree on @KingJ Hopefully a PR can be made soon enough. I just can imagine the struggle of new comers when they will be presented with such overwhelming name scheme

DubhAd commented 6 years ago

There's already been two threads on the forum in the last half day where people have been confused by this and struggled with renaming their Z-Wave devices.

balloob commented 6 years ago

@DubhAd it shouldn't be done automatically. You change the name, not the identifier.

point-4ward commented 6 years ago

^ from an end-user perspective that's the same thing.

Example: Fibaro multisensor - has 7 or so sensors. I rename the node to 'kitchen'. Clearly I expect the sensors to now be called sensor.kitchen_motion and sensor.kitchen_temperature.

That's the only reason to rename the node in the first place, as zwave.kitchen for the device makes no difference whatsoever for automations or anything.

KingJ commented 6 years ago

Indeed, until I sought help on the forums I had zero idea why my device had been renamed in one place (e.g. the main dashboard was showing the new entity ID), but automations were using the old ID.

I've found Home Assistant in general to be a pretty user-friendly platform - the documentation is good and a lot of functionality is naturally intuitive. This unfortunately hasn't quite been the same. At no point in the Z-Wave renamer was there any opportunity for me to know that I also had to rename the identifier in the Entity Registry, and from the dashboard's perspective everything was using the 'renamed' entity ID (quite literally, if you were to click on a component on the dashboard, the entity ID listed is the 'renamed' one, not the identifier contained within entity_registry.yaml - as per my post linked above).

I can appreciate that there's still a lot planned for the Entry Registry, but right now it is not at all clear to the majority of users that you need to update the Entity Registry if you rename a device and want to use the new name for it. The inconsistent display of the entity ID after a rename only further adds to this confusion - from my perspective I had renamed the node, and the dashboard was showing the 'renamed' entity ID - I didn't have any reason to think otherwise that the 'renamed' entity ID displayed on the dashboard was not the one I needed to use if I wanted to reference that component in an automation. I had no way of knowing the difference until I went in to the Services Dev Tools, and even then it wasn't apparent as to why the old entity ID was there.

To improve this i'd personally think one of the following would be appropriate for most users - and preferably the first option;

Additionally, it could be useful to surface the Entity Registry's Entity ID when viewing the component's details on the dashboard. A lot of users 'discover' the entity ID from here that they then use in an automation - so if the entity ID on the dashboard is different from the Entity Registry's Entity ID, that can become rather confusing.

(Hope this hasn't come off as overly negative - I love HA overall but unfortunately at the moment this particular area is at odds with the rest of HA, which is in general really intuitive and user friendly)

moskovskiy82 commented 6 years ago

I completely agree with @mf-social Even fibaro dimmer 2 exposes 10+ enitites. So let's say somebody decides to switch to HA from OH2 with 10+ of those dimmers. 100+ enitities to play around and rename manually figuring out which one is which. That sounds like a lot of fun. Really :)

DubhAd commented 6 years ago

@balloob This change fails the POLA check since it changes the existing behaviour completely. It's also an undocumented breaking change.

Either Rename Node needs to interact with the registry, or it needs to be removed. What we have currently is the worst of both worlds - a service that achieves nothing, but used to change the entity id and according to the documentation still does.

frog32 commented 6 years ago

Not sure if it is related but since 0.63 also hiding some z-wave sensors by using the checkbox is broken.

dshokouhi commented 6 years ago

You know the more I think about it. The more I wonder if Rename Node just needs to be removed. Upon further inspection the zwave entity itself is missing from entity_registry.yaml. Based on what Entity Registry is supposed to do for the end user we should make sure those entities show up there right? All renaming should be done in 1 place to make things easier for the user.

point-4ward commented 6 years ago

... Which begs the further question:

Should devices that spawn multiple entities have a different type of entry in the entity registry? Maybe tiered somehow?

As was pointed out earlier, somebody with 10 Zwave devices should only have to change 10 things, not 70 - 100.

moskovskiy82 commented 6 years ago

@dshokouhi definitely it shouldn't be removed. Yes 10+ entities are needed as they are different sensors and calling them out through attributes in automation will be more complicated. Those are my 5 cents.

DubhAd commented 6 years ago

@dshokouhi IMO the best solution is to integrate it with the entity registry, so that Rename Node causes the entity IDs to be updated, as they were before 0.63.

Failing that, yes, it should be removed so that people aren't confused as to why it's only changing a couple of attributes, and the default friendly name. What we've got now is just confusing people, there's not a day that goes by where we're not seeing multiple posts in the forum or Discord about this.

flamingm0e commented 6 years ago

If this is a 'component that is still in development phases', it should NOT have broken the old way until such time that everyone could transition away, or we had fully documented, or capable ways to manage the entities.

You broke the usability of adding zwave devices without so much as a notice in the release notes, and with no documentation on this new method. This is a breaking change and should have been noted as such.

onlize commented 6 years ago

I made all necessary changes in entity_registry.yaml when I updated to 63.x version and automation worked until I updated to 64.0. Updated to 64.1 but it did not help. I had ZWave switches to turn off in 10 minutes. I also tried to use old IDs and new IDs, but the automation still does not work.

onlize commented 6 years ago

I was able to fix the problem. I opened Automation page, selected the automation for switches and clicked on save button. It modified the code a little and works now.

macstibs commented 6 years ago

I'm new to this platform but have had a zwave network in my house for a few years. I've been getting hassio up and running in an effort to migrate away from a Vera controller (which has its own issues). I finally got the onboard Zwave controller on my PINE64+ up and running last night and started to add devices today. After I got to about 5 devices, I realized that renaming them wasn't working.

So (having come from another ZWave system) that the ability to rename devices as they're added to the network/system is a critical path item. Without that (relatively) basic capability, zwave functionality is too impaired to be attractive. Whether there's a way to manage it without linking the process into entity_registry.yaml, I couldn't say. But either way, removing the functionality from the front-end should be a non-starter.

And I'd probably pay someone for my 2 cents worth...

reevery commented 6 years ago

I've just moved my zwave network ono HA, the hard way. Rename node is changing the root, and I can change entity names in entity_registry.yaml, although I have to wait for zwave config to write it into the file, and it is time consuming.

So I'd very grateful for the renaming to be automatic.

For many of my devices, I had to create a customize record too, or a template device (eg battery level).

I'd like to keep in mind that some of these changes coild be solved with a device class template: for any zwave device with class X, template X will be used to change the entities.

Then anything device specific can be done in customize, eg template lights for certain switches should be for one-off fixes, changing on/off behaviour, etc, weigh we'd have a lot less to do.

justyns commented 6 years ago

A small workaround I've been using to make this a little less painful.. You can use Rename node to rename the root node, and then click the save config button to have it write to the zwave config file. Then stop hass and delete all of the old entries out of the entity_registry.yaml for that node. If you keep the file in version control, it's a little easier to find the new ones that were added.

After you delete the old entries and restart hass, it should name everything with the prefix of what you named the root node.

IainPHay commented 6 years ago

@justyns for this suggestion. I have been battling with getting an automation to work for days having used the new entity from the panel. I eventually worked out what was going on from the logs and have my automation working but finding the entities to use customise and hide the ones not needed on my door sensors is time consuming and messy, this suggestion at least keeps the naming conventions sensible.

I’ve found homeassistant to be very easy to configure in general but this is just plain broken imho. The disconnect between the new entity id and the registry entry is not immediately obvious, I’m no coding expert but I’ve been around and this has been extremely frustrating with 3 zwave devices.

A simple warning statement on the z wave page should suffice to let people know whilst a more elegant solution is developed.

It’s probably because HA is so good and so well documented elsewhere that this is so frustrating.

Timple commented 6 years ago

I was tracking this issue, but it seemed unactive. So today I had a couple of hours to spare and decided to give it a go. I upgraded from 0.61.1 to 0.66.0. I got an error stating that I had to remove the new_entity_ids setting from the config, so I did. And everything worked out of the box. So have any secret improvements been made that we are unaware of?

As expected an entity_registry.yaml has been created but I haven't modified it in any way.

point-4ward commented 6 years ago

Presumably you already had your entity ids set? That's not the problem. The problem is if you add a new device now, you'll need to go through the entity registry and change all the individual ids.

Timple commented 6 years ago

Hmm, then I'll have to wait until I have to do that. Ik can remember that everything zwave-related was broken when I upgraded to 0.63. So I just assumed it was this issue. I'll update once I've added a device.

reevery commented 6 years ago

There's a further (probably related) issue. Every time I have been adding a new node, all of the existing nodes have lost their disabled_by property. Names seem to be ok.

DubhAd commented 6 years ago

@Timple The removal of the new_entity_id value was mentioned in the 0.66 breaking changes (https://www.home-assistant.io/blog/2018/03/30/release-66/#read-more). Any questions about that are best kept to the forum ;)

@reevery Best to open a new issue about that, because even if it's related, it's not what this issue is about.

rogersmj commented 6 years ago

I just want to echo the above comments that this behavior is infuriating...I couldn't figure out why renaming my Z-Wave nodes was no longer renaming the entities attached to them. In the Z-Wave config, it shows my new name, but the entities listed on the dev-state page are still the old names. I spent a long time digging through forums threads and eventually arrived here.

Look at this example. This Z-Wave motion sensor used to be called "OfficeMotion". I renamed it to "PlayroomMotion" using the Z-Wave control panel, saved, and restarted HA. This is what Z-Wave CP shows:

image

NOTE THE LIST OF "ENTITIES OF THIS NODE". Specifically the binary_sensor.PlayroomMotion Sensor.

Then I go over to the device list and binary_sensor.playroommotion_sensor is nowhere to be found. Instead, I still have the old binary_sensor.officemotion_sensor. I also still have the zwave device with the original name, zwave.officemotion, although it now shows a friendly name of Playroom Motion...that's not helpful:

image

So basically, there's now inconsistency between what the Z-Wave control panel shows as the attached entity names for a z-wave device and what entities ACTUALLY exist. And, the Z-Wave node renaming feature is essentially pointless.

LeapFrogSupport commented 6 years ago

What a disaster - why would we release a breaking feature labeled "experimental" without the ability to make it optional? Had I not already been a (fairly) experienced HA user and encountered the issues associated with adding a new device post-implementation of the entity-registry, I would have given up on HA altogether. This situation needs some serious attention, and sooner rather than later.

macstibs commented 6 years ago

This issue has all but ended my efforts on the platform unfortunately. I got my outdoor lights running and have control over the environmental assets in the house, but everything else is DOA.

[image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5& 06/21/18, 11:45:38 AM

On Thu, Jun 21, 2018 at 11:31 AM LeapFrogSupport notifications@github.com wrote:

What a disaster - why would we release a breaking feature labeled "experimental" without the ability to make it optional. Had I not already been a (fairly) experienced HA user and encountered the issues association with adding a new device post-implementation of the entity-registry, I would have given up on HA. This situation needs some serious attention, and sooner rather than later.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/home-assistant/home-assistant/issues/12430#issuecomment-399145459, or mute the thread https://github.com/notifications/unsubscribe-auth/AYHs3cj5xIYZXZasEkS4qjY_iPT0LfSbks5t-7xpgaJpZM4SGp8w .

timpeq commented 6 years ago

The easiest way I've found to work through this is to remove the entries of any renamed devices from entity_registry.yaml and restart hass. Maybe there should just be a re-build registry button in the z-wave config page which will update all entity id's, or possibly a list with checkboxes to only re-build selected items.

edwinvandalen commented 6 years ago

@timpeq : I'm missing the point. what does that do?

Until now I'm sticking to 0.62 while I'm building my home setup. Renaming works like a charm but of course this is not sustainable. I would like to understand your workaround a bit better...

timpeq commented 6 years ago

@edwinvandalen In my case when I was trying to rename zwave switches an entity id was not changing until I removed all entries of the zwave and associated switch in the entity_registry they were created with the proper names.

edwinvandalen commented 6 years ago

ah, so the workaround process would be to

1) backup the entity_registry 2) include a new z-wave device (which puts default names in the entity_registry) 3) rename the new z-wave device (which does not modify the entity_registry :-() 4) replace the entity_registry with the backup 5) restart hass

?

andreasfelder commented 6 years ago

These days I usually do the following: Include new zwave device Rename zwave device Rename zwave device and all other related entities in device registry Restart home assistant

This leads to all names being changed and only requires a single restart. This is for sure not how it should be but I guess until the rename process is fixed we will have to deal with this.

rogersmj commented 6 years ago

So here we are, 6 or 7 months later, and the entity registry concept has still not been fully reconciled with the Z-wave feature set. I don't know enough about the inner workings of this to help, or even who to tag in here other than @balloob, but this is really a disaster and needs some attention. Z-Wave, although not the new sexy thing on the block, is still used extensively, and this stuff needs to work.

awarecan commented 6 years ago

Did you tried the new feature to rename entity_id through UI?

dshokouhi commented 6 years ago

Is this even a bug still? You can still rename things, just not the way you did in the past. There is nothing that you could do before that you can't do today. Every zwave entity ID can be renamed. Just not from the zwave panel. Please tell me otherwise if that is the case but renaming nodes is not a "mess" there is just a new process to follow (regardless of it having more steps) Also as @awarecan pointed out you can now rename directly from the UI. So what features in 0.63 are missing from 0.75?

rogersmj commented 6 years ago

Yes, you can use the UI to go find and change your entity names once you can find the right ones. The situation still exists where if you rename a Z-wave device from the Z-Wave control panel, it shows a set of entity names that don't really exist (see comment from June 19). That, at bare minimum, is a bug. The zwave entity itself (zwave.*) also doesn't reflect the new name of the z-wave device, and I would argue you would expect it to.

So there is no obvious or intuitive link between the two features, or what steps you're supposed to follow if you want consistency between your renamed Z-Wave devices and the entities associated with them. It's extremely confusing, and it took a lot of digging and troubleshooting to figure out what was going on. If someone renamed a bunch of z-wave devices at once, it would be a lot of work to trace down what HA entities are associated with which z-wave devices, since the entity list UI shows the old zwave.* name. So yes...I would still say a mess.

Someone else suggested something along the lines of having a way from the UI to clear out entity registry items associated with a z-wave device as part of the z-wave renaming process. Not sure what other ramifications that might have, but it sounds like a possible solution.

stiansoevik commented 6 years ago

I agree it's still confusing at best. My suggestion:

balloob commented 6 years ago

The Z-Wave node renaming is going to be removed from the Z-Wave control panel. There should only be one way of doing things and that is via the entity registry which supports both name and entity ID renaming.

gsemet commented 6 years ago

Hello. Can I ask the dummy question: why is that you need to do special convention for z-wave (ex: the "location" proposal two comments above)? Why not extending the solution to every other types or devices (ex: rfx auto discovered entities? they also are not human readable).

My opinion is that a node should be renamed easily with custom defined convention (I may or may not add the location on my devices, dependending on my need), but sure it should resist to removing/adding the same device. At the end we should have:

I still use Domoticz for Z-wave management (I only have sensors) + mqtt, its UI is really helpful (and have some cool stuffs). Hope to switch z-wave to HA soon to discontinue domoticz completely. But damned it's easy to deal with z-wave devices with DZ !

MuppetOwl commented 6 years ago

How to change the node name now? This was much easier before. Did just use rename node in zwave control panel and delete the entity registry and all of the new devices with sensor etc was created with the correct name on next reboot. including in the zwave device list. Now this is a mess.

Edit: see the the rename service still exist. Thanks for that. So I was able to fix this without using the entity registry.

cgarwood commented 6 years ago

You can literally open the entity_registry file in a text editor still and find->replace the entity_ids. It's not really that difficult. Just make sure HA is shut down when you save the changes. I've never understood deleting everything when you can almost as easily find->replace them and have complete control over them.

MuppetOwl commented 6 years ago

Yes did try that. But it did not update the names in the Zwave controll panel list. Just on everything else. But did not stop HA, so maybe that was the problem. Need to have the correct name in the zwave control panel to when I have 6-7 identical devices.

Why not just options? Is it very difficult to have the rename node button in the control panel for Z wave?

dpritt commented 6 years ago

I have just added several new z-wave devices to my HASS instance 0.73.2. The only way I can differentiate them in the States tab is by the node number as they all report with the same name and a unique number. I change them using the rename feature on the States page, but I still find I have to use the name + unique number in several Yaml files. We should be able to change the Friendly_Name stored against the Z-Wave Node, and this should then be reflected throughout the system, as all these devices have multiple values in the States, changing the node friendly-name should change all the relevant items as well.

This is such a basic requirement I can't see why the Rename Node feature does not allow this as it used to do last year.