A workaround for this when a sensor is used in automations would be to use a helper group of one. It may only make sense when you use a sensor in multiple autiomations, but at least you’d only have to change the sensor in the helper group and not in all of your automations.
Not sure if it has been mentioned, but when renaming devices and you get the “Rename” button for the entities, I’d like to see a preview of the renamed entity ids that you can change. On multiple occasions HA messed things up because the old entity_id was not quite right.
make a separate wth please
Any updates here? I need to rename a number of entities, and I dread trying to track down all the automations I have to fix. Seems like basic functionality that should NOT break. I’m used to the Hubitat hub, where you can rename almost anything and it has no functional impact to automations, scenes, etc. I suspect they use back-end GUIDs.
Just use find and replace that checks multiple files. Notepad++, vscode, etc
Just to find a middle point (because I don’t want my entity names automatically updated to anything, when I set an entity in a scene is because I want that scene to activate whatever entity has that name at the scene trigger moment), I think there could be a tool that shows you options, lets you manually select when you are changing a device so it sets the previous entity to the new one, and another tool for renaming and entity and having it automatically renamed system wide. With triple checks and a list of where it is being used.
Just saying. Avoid system wide renamings unless they can be supervised and approved by the user.
R.
I stop Node-Red when I’m switching devices and updating entities because I think in some cases it mixed a couple of devices/entities in the process.
Then I start it again and everything works fine.
this feature seems so basic and useful, it should have been there for years !!
I guess it is not trivial to add, that would be a good explanation
I wish it can be added somedays, I keep my finger crossed
there’s already tons of tools that allow you to do this. That’s the most likely reason why it’s not a high priority. Download the VSCode addon, do a find in files, and update your entity_id in 1 shot.
Hi,
I tried to go this road in the past, but since I’m a happy docker user, I can’t do it
For a time, I was thinking to add another docker VSCode container, but it was not as easy as installing the addon, and I gave up.
Maybe I shouldn’t have I’ll try to find a good tutorial.
Unless you know another way ?
Then you can just use VSCode normally. Or notepad++. Or any other text editing software that can search for a string inside files.
should I shutdown HA before editing all the files ?
Nope, make sure to exclude hidden files (.storage folder). Make a backup if you are unsure of things. And go 1 by 1 w/ each replacement. I.e. click next, look at the change, click replace if it’s valid, etc.
many thanks. I’ll give it a try, but it means I cannot do it from the GUI (locally or remotely) and I need to map the folder to another machine in order to do the search and replace.
Not as convenient as something that could happen automatically in the background by HA but I understand it has not been a priority
+1 this would be useful. Although I know I and others can achieve the same effect manually, I imagine the lack of an automated refactor feature is a point of frustration for many less technically inclined users that stunts HASS growth.
So since we now have the better automations, can we get some clarification on this. Like does HA team know it is an issue? Why is even the actual name used and not guid / uuid / … (i get advantage when replacing the device with another, but maybe there are more?)
Now I’m at another, and i know it will not be last, rename / clean up spree to be more organized, but I already know I will lose the history etc.
This I do not want to just criticize, HA is the best out there for this kinda (“smart”) home stuff.
Last year lot of things got better, but still I think there is lot of this, kinda, small stuff, that “hurts”.
I see this post WTH when I rename an entity, most of the time it's history is lost? - #6 by bdraco and supposedly history remains, which for me, at least with the energy entries I tried confused me a lot as I still saw the history.
I will try it some more, but for me, loosing data about absolute humidity and temperature and then manually searching the database was much greater pain than fixing the automations, would be awesome if this part of renaming would be solved.
I also got some duplicated entries for esphome devices that broke automations, but probably totally unrelated to renaming
Anyways I see stuff in HA is actually getting updated for the better, which is, sadly, very very rare these days.
Another vote for this. This gets in the way of Z-Wave to Z-Wave LR device migration. The entity IDs have the node ID embedded. Eg button.node_135_ping . When migrating to LR, the device will get a new node ID >256 . Keeping the existing name as is would be very confusing. There should be a way to automatically migrate the device and rename the entity, without breaking existing automations.
And obviously as a user, I sometimes dislike the default entity names for a device if they don’t “speak” to me, and would like to change them, but not at the cost of breaking everything. For context, I currently have 1418 entities in HA. The suggestion that I should manually edit config files to rename them is not scalable.
This is a sorely needed a feature that should have been there years ago.
Find and replace using the vscode addon, takes all of 30 seconds.
It’s not 30 seconds if you have a lot of entities to rename, and among my 1418, there are many that I would prefer to rename.
A VSCode search-and-replace can still be error-prone, especially if there are substrings involved.
The database history also needs to be changed, if I understand correctly, and that won’t be done by VSCode.
This problem is such an obvious need that I don’t understand the reason for the pushback . Is there a technical reason why this is not feasible, or very costly to implement ? Or is it strictly about it not being considered important enough ? Or a decision by UI/UX designers not to do this ?
It’s literally 30 seconds. Edit → Find in Files → Enter the name you want to replace, enter the name you want to replace it with, click “change all”, done.
Here’s a screenshot of all references to my exact entity_id light.living_room
and all it’s references.
No it doesn’t. Renaming the entity in the UI takes care of that.
At most, this is 2 steps.
Step 1, rename in UI. Step 2 findall → replace.
Lastly, this is only needed if you use service_calls. If you use device triggers, actions and conditions. The entity_id doesn’t matter and nothing needs to be renamed because those actions use the entry_id for the entity.