WTH is there no "refactor" functionality when changing an entity name?

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.

3 Likes

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

1 Like

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 !! :slight_smile:
I guess it is not trivial to add, that would be a good explanation :frowning:

I wish it can be added somedays, I keep my finger crossed :crossed_fingers:

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 :frowning:
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 :slight_smile: 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.

1 Like

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.

1 Like

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 :slight_smile:

+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.