How to rename an entity?

I have entities with auto generated names, such as Zigbee sensors. I would like to make sure I know which sensor refers to which “physical place”.

I found two places where I can rename these entities (“rename” is probably not the right word, it is rather an alias or a friendly name (depending on the place) as the original name is still available).

The first one is via the “Entity Registry” in “Configuration” on the front-end. It seems that the name is changed in an internal database ./.storage/core.entity_registry

The second one is via “Personnalisation” (same place). The friendly name is added to customize.yaml.

Which one should be used?
Are they equivalent?
Do both cover all the places names appear?

All the tools for renaming entity_id’s and friendly names are now accessible from the UI. No need to modify entity registry files.

image

Sorry for shitty handwriting.

2 Likes

Thank you. So that would be a third way to set this up.
It looks like it combines the others. From the same path as in your step-by-step images (thanks for that, the handwriting is fine :)) I see

image

loggia_battery was set in Configuration --> Personnalisation

loggia batterie was set in Configuration --> Entity Registry

I will try to remove all the personnalisation / friendly naming I did and go your way to see how this is reflected in the frontend. EDIT: it is reflected perfectly.

1 Like

This works as long as your entity generates a unique ID. More and more platforms do that now.
In case you come accross one that doesn’t, I am looking at you efergy, you can fall back to the way you started out.

1 Like

For anyone else who gets here through the same misunderstandings as me…

For some reason you can’t change some entity names in the UI (for me they’re MQTT ones through Mosquitto, perhaps that’s it).
You CAN change them in customize.yaml
It took me a while to realise that this doesn’t exist by default.
Create it in the same folder as the others.
Add this to config.yaml:

homeassistant:
  customize: !include customize.yaml

Then add things like this to customize.yaml:

thermostat.family_room:
   entity_picture: https://example.com/images/nest.jpg
   friendly_name: Nest

Any way to change the entity name (not the friendly name) in the yaml file? I have all my coolmaster devices listed with just numbers, and i rather rename them to the actual rooms.

That depends on the integration. Some allow you to change the entity_id, some don’t.

Thank you for showing how to rename via UI.

But if I try it this way, I’ll get the message “Invalid entity ID”, when I try to save it. (HAOS on x86)

Any ideas why?

What are you renaming it to? There are some rules regarding symbols you arent allowed to use.

Yes, you’re probably using spaces or invalid charactesr. entity_id’s can only be the following characters:

abcdefghijklmnopqrstuvwxyz_

Nothing else, that includes spaces, capitals, and odd characters.

1 Like

I tried to follow along with the images and instructions but maybe HA has been updated and the UI looks different since it was posted…

I have a zigbee Smart Outlet by Third Reality, initially I had it to switch on and off the Christmas Tree, so I originally named it Christmas Tree… now the Christmas Tree is no longer there, however we have now connected some String Lights to it. The device has a number of entities? sensors, buttons, etc., and when I renamed the switch part (outlet), in HA, it appears it did not change the entities, so I updated the entity id of it, but it only changed that one, now there’s all these other elements? that have the wrong name.

  1. How can I rename something so that it affects all of it’s associated buttons, sensors, entities, elements, id’s? (I’m new to HA so I do not know the correct term here)
  2. When something is renamed, if it was previously used in an automation via Node Red, does HA automatically update the name in the automation it was in, in Node Red, or did I just break the automation and need to go fix each piece in Node Red when I rename something?

The entities are likely attached to a device. If you rename the device they’re attached to, all the entities attached will be renamed in kind…

If you didn’t edit it… :sunglasses: (sorry)

So go up a level for entity to device. (you should be able to find it from - related- in the three dot menu)

Entity :

Related Device :


(all the other entities)

So to fix where you’re at. Find it l, find it’s device, rename the device. The look at the entities in the list and fix the ones theat are now outliers (the one you renamed on its own)

entity_id is the key name that your automation and node red key on. If that stays the same for any given entity then no edit required. If you update the entity_id then absolutely you will need to make an edit.

When making automation best practice is target entities not devices.

Okay I did that, I renamed it from String LIghts to String Light to make a change, however all of the other erroneous names still say something like christmas_tree_power, christmas_tree_sensor, christmas_tree_current, etc…
In the screenshot look at the hyperlinked blue text.


image

Change your device name to Christmas tree, click no to renaming entities. Then change device name to something else, then click yes to renaming entities.

The system is simple. It simply renames the common words with the device name at the start of your entity id.

1 Like

Okay so I renamed it back to Christmas Tree, nothing pops up asking me whether to renaming entities, is that a setting? I then renamed the device back to String Light, again nothing pops up to asking about renaming entities.
Maybe I’m doing it in the wrong place, or do not have something enabled?

Odd, seems to work here. Not sure where you renamed the device. If I rename the device from the device info page with the pen symbol in the top right then I get a popup asking if I want to rename all associated entities too.
Did you rename the “base” entity only per chance?

In detail:

  1. I started off with (all entities named rad_0) (sorry, no screenshot because only single embedded item allow for new users)
  2. Then I went over to the device info screen (Settings->Devices & Services->Devices->[name of device]) to change a single entity’s name to “emulate” the mix you got. I scrolled down to a sensor Heat required, clicked on it got the popup with the history.
    Clicking on the cog wheel I get an dialog where I can change the specific entity name and added a “x” to the Entity ID so the rad_0part read rad_0x now. Clicking Update changes the name as expected without any other popups. Note that all references like history, dashboards, automations are broken now and would need to be updated.
    In dev tools it is reflected e.g. all device related entities are named rad_0 except the heat required one.
  3. Next I went back to the device info screen and clicked on the top right pen symbol (marked with red in the below screenshot) which then got me to a popup allowing to change the device name. Here I renamed the device adding a xyz to the name so that it has rad_0xyzin the name.
    Clicking Update got me a popup asking if I want to rename all entities. Expanding the entities list it then looks like this:

    I see all the entities with old and new name. The heat_required is a outlier with rad_0xxyz ,e g. the xyz got added there too keeping the previous x in the name.
    Clicking renamerenames all the entities as anticipated.
    After this the dev tool view looks as expected now too with all entities related to this device having a rad_0xyzin the name except the head required one which has rad_0xxyz.