Entity_id vs name (of entity)

Hi,

It is certainly a noob question but I fail to understand why there are two names for an entity (entity_id and name).

Is there a different use for each one ?

NB. I am a HA beginner user.

entity_id is the under the hood name. They are unique and there are no two like entity_ids. Name or friendly_name is user assigned and what you see in the UI. They are not unique and you can have 1000 entity_id’s with the same name if you want.

All software does this in some way, shape, or form. It’s so the software can track what the item and the user can name it whatever the hell they want.

Thank you for the explanation !

Now I understand better. For example I may give the same"generic" name such as “ceiling lamp” for each room while the corresponding entities id could be john_room_ceiling_lamp and mary_room_ceiling_lamp so I can recognize them when I create automations.

Hi,

I’d like to know why some entities can not have custom entity_id? For example when I define a MQTT switch in configuration.yml, the entity_id is derived from name, which mean when name changes entity_id changes too, which I don’t want. “Unlocked” entities can have custom entity_id, but not ones defined in that .yml file. Why?

Because ones defined in yaml are hard coded in yaml. The ones that can change have a unique_id attached to them in the background and the software tracks off that. Some platforms/integrations that use yaml allow the unique_id identifier which allows you to change the entity_id in the UI.

So, not all entities have unique_id and in that case, name-derived entity_id is used as unique id and could not be changed?

Some integrations were written 6 years ago and have not changed. When they were written the dev decided to use the name to create the entity_id.

1 Like