This entity does not have a unique ID

Well it’ll still help users understand.

1 Like

I just by accident saw this thread. I was anyway already updating the FAQ entry to reflect some upcoming frontend changes and now extended it a bit more.

Feel free to comment in the PR: https://github.com/home-assistant/home-assistant.io/pull/16260

Direct preview link: https://github.com/home-assistant/home-assistant.io/blob/4bcd065b2c5680737df78c495029db2be02dca7c/source/_faq/unique_id.markdown

2 Likes

This thread is exhausting and adds very little to understanding. I’ve only recently started using HA so consider myself a newbie to it but I work in IT so also consider myself reasonably familiar with the concepts usually used therein. So anything called a unique id is precisely that, or at least should be. From this thread I can’t work out if it actually is unique or isn’t!

Anyway, I came on here because i have a problem. I have a zombie Sonos entity I cannot delete and I get the entity does not have a unique ID so use yaml error message. However, I never created it with yaml in the first place so the error message is actually wrong, irrespective of the subtleties discussed above. Clicking on the link in the error message doesn’t help me at all in working out how to delete it. Yes, my system is working, somehow I have another entity to the Sonos system which works yet how I ended up with two instead of one baffles me. However, aesthetically and correctly, I should be able to delete the zombie entity.

So to the reason I came on here in the first place, how do I delete it please?

Go to the Sonos integration, click on entities, find the entity in question click it. Then toggle the disable switch.

Thanks but it’s not in the list of Sonos entities. It’s greyed out in the overall list of entities (I can’t click on its check box) and if I try to remove it from there, I get a pop up that says " This entity is currently unavailable and is an orphan to a removed, changed or dysfunctional integration or device. If the entity is no longer in use, you can clean it up by removing it. " except I can’t. I click on the red REMOVE ENTITY link, confirm I want to remove it but it stubbornly stays put!

it is unique but not every entity has it set. So in result it cannot be used to identify every single entity, only those which have unique id set.

In contrary there is entity id (in some integrations it’s automatically created from entity name), which is slso unique (during runtime) and it exists for all entities

There are more differences between them:

  1. Unique_id guarantees uniqueness across all domains (lights switches secors etc) while entity id is unique only in the domain it belongs to.

  2. if two entities have the same unique id, the system will raise an error on start.
    In case of two entities with the same entity id set (in the same domain), the sytem creates both entities adding numeric suffix to one of them. In this special case I’m not sure if the suffix is applied to entity id, or only during creation of entity id from entity name

I had a similar issue with “This entity does not have a unique ID” when looking in the list of entities.

Use case:
installed mqtt integration
installed tasmota integration

setting up new tasmota device
SetOption 19 0 / 1 toggled more than once.
Removed the one tasmota device from Home Assistant as I was attempting to convince tasmota to recognise the device as an RGB LED controller.

In the end I had a an extra entity called light.tasmota_2 that was shown as unavailable and could not be removed and was showing “This entity does not have a unique ID” which eventually led me to this thread.

Could not find the entity in .core.entity_registry.

in the end, a restart of home assistant convined the phantom entity to disappear.

Is all this still the status quo? I would like to add areas to my entities and this is only possible, if they have a unique_id, correct?

Can I (by chance in the meantime) add unique_ids in yaml for defined or auto-added entities e.g. from

  • platform: time_date
  • platform: fritzbox_netmonitor
  • platform: rest
  • platform: command_line
  • platform: group
  • sun.
  • zone.

and for

rest_command:
script:
Hue-groups

etc.

Some of them,all of them, none of them, …

Or to add whatever that I’m able to assign them to areas then afterwards.

You can only add unique_id if the integration supports it. You can only tell if the integration supports it by looking at the docs.

If the integrations do not support unique_id, you cannot just add it to the configuration. Also, this means you cannot assign an area to it.

You’ll have to be patient with old integrations. It may take years before unique_id is added.

1 Like

Thanks for the fast reply. That was my apprehension. But/because I didn’t understand, why the entity-id, which should be unique as well or something else is enough for assigning areas or do UI configuration.

So none of my examples do support assigning areas at the moment. Correct?

I don’t know, check the docs for each integration. If the configuration is through the ui, they do support unique_id and you don’t need to do anything. If the configuration is yaml and unqiue_id is absent, then it does not support unique_ids.

Unfortunately, this is not the case.

E.g. Scripts afaik, whyever in opposite to automation, even if created only in UI, do not have them and cannot be assigned to areas.

And yes, I only found them for templates and mqtt. But hoped, that there are already more but the doc is only not up2date.

Yes it is. It’s a requirement for config flow. If you configure the integration through the UI, each entity will have a unique_id.

If you configure the integration through yaml, typically it will not have a unique_id.

Scripts are unique as they don’t have unique_id’s.

Hm, yes, that was my point. Created via UI, but do not have it, in oposite to your rule. :wink:

Why do automation have them and/or how to assign scripts to areas in this case?

Scripts are part of the core. You asked about integrations :wink:

You can’t. I don’t know why scripts don’t have them.

1 Like

No. I asked for however defined/created entities. :wink:

I want to add an area to my group.office entity. Unfortunately, this doesn’t have a unique ID.
for light groups i use the uniqiqe id in yaml and use this gui dialog (unique ID required):

I cannot set a unique ID with groups in yaml (like with lights). How can I add a area to my group.office entity?

1 Like

Groups don’t accept unique_ids, so you can’t assign it an area

See:-

For something that may work using templates to add the ID’s

That won’t work for groups because it’s in the group domain. Your link is a template sensor, so that will only add a unique_id to items in the sensor domain.