In many cases my automations are 10 years old. Back then, “id:” and “alias:” had usages that have been perverted. They are now both used in some capacity to generate [unique] identities for automations. I have seen “platform automation does not generate unique IDs warnings” for many months now. I knew that I had no actual duplicates (I checked both my yaml automations and my UI automations to make sure. No duplicates. But, I decided to change IDs and or aliases to see if I could correct the warnings That just made things worse. Very frustrating (there was a time when HA just worked). So, I took a look at core.entity_registry in .storage. I found that every time I changed either an alias or an id HA created yet another automation entity (can’t prove it, but it sure looks that way). My favorite example occurred when I completely renamed the id and deleted the alias. I got two new automation entities - one with the changed id and one named automation.automation_151. Of course, I now get the warning “Platform automation does not generate unique IDs. ID turn_lifx_ off_when_mains_power_restored already exists - ignoring automation.automation_151”. There are 81 such warnings every time I restart HA. I have tried deleting and disabling automations, but can find no way to fix this mess (and I get similar warnings from esphome). I am on the verge of copying and editing the core.entity_registry, but thought I would ask this forum once again how to overcome this mess? Can Spook help me? Is it part of the problem?
If you truly believe this is broken, it would be best to open an issue on GitHub:
Yeah, don’t change unique ids.
If you really need to then this is the way:
- Cut the automation from your config file and save it elsewhere.
- Reload automations or restart HA.
- Then, and this is the important bit, delete the “restored” automation from the Devices & Services → Entities list.
- Then you can paste back the automation and change the unique id (if you must) before reloading/restarting.
Same goes for deleting yaml automations with unique ids. You also need to delete the restored version from the entities list after reloading/restarting.
Just remember that there are two places that you need to adjust. The yaml and the entities list.
I brought this up as an issue ages ago (needing to delete in two places) but was informed that it is working as intended. So I’d suggest not opening an issue.
Thanks Tom. I only changed one unique_id in an attempt to correct the duplicates warnings. I have 81 reported duplicates (of course none are actually duplicates) so I would have to remove/save and delete that many times? Am I correct that any automation that has both an id: and an alias: will be seen as having a duplicate? If so, is it “better” to use only id: or only alias: ?
id
is used by the system to keep track of the automation.
alias
is used to generate the entity id.
Can you take a screenshot of your automation duplicates in the entities list. Including the right hand status column.
Hi Tom. I can’t find a way to take a screen shot of more than a few automation entities at once (I have more that 100 automations). Anyway, that view doesn’t show any duplicate names or duplicate enity_ids. My issue is the warning report of 81 duplicates when there are none that I can find. Should I send core.entiry_registry?
Here are the warnings:
Logger: homeassistant.components.automation
Source: helpers/entity_platform.py:773
integration: Automation (documentation, issues)
First occurred: 11:24:35 AM (81 occurrences)
Last logged: 11:24:35 AM
Platform automation does not generate unique IDs. ID coachlights_off_at_day already exists - ignoring automation.coachlights_off_at_day
Platform automation does not generate unique IDs. ID coachlights_switch_always_on already exists - ignoring automation.coachlights_switch_always_on
Platform automation does not generate unique IDs. ID lanterns_alarm already exists - ignoring automation.lanterns_alarm_if_late_night_motion
Platform automation does not generate unique IDs. ID pole_on_at_sundown_if_home already exists - ignoring automation.pole_on_if_dark_or_sundown_and_home
Platform automation does not generate unique IDs. ID turn_lifx_ off_when_mains_power_restored already exists - ignoring automation.automation_151
The first warning above is for “coachlights_off_at_day”. It exists only once in core.entity_registry with these attributes:
“id”:“coachlights_off_at_day”
“entity_id”:“automation.coachlights_off_at_day”
“unique_id”:“coachlights_off_at_day”
“previous_unique_id”:null
Why is reported as existing already?
the entry for “turn_lifx_ off_when_mains_power_restored” exists once with these attributes:
“id”:“turn_lifx_ off_when_mains_power_restored”
“entity_id”:“automation.automation_151”
“unique_id”:“turn_lifx_ off_when_mains_power_restored”
“previous_unique_id”:null
Again, why is it reported as existing already.
Also, this entry was created when I changed the ID and deleted the Alias. So, should previous unique id be null?
Using the existing id: parameter instead of creating support for unique_id: seems unfortunate to me.
For the listed automations:
You can do all of them at once.
OK. Got this before, but haven’t done it yet. I can easily make all of my yaml automations temporarily unavailable. Is there an easy way to identify “restored” automations other than by name? I also have a number of automations created by UI and from within the old HASP Package.
Since this is about warnings, I’m beginning to question whether the effort is worth it. So what if HA can’t properly identify duplicates!
The icon in the status column.
Removed automation shows up as “not provided” in status column, not “restored”. Are there any “not provided” other than “restored”?
Ok I haven’t had to do it for a while, it has changed. So yes delete them and continue with the instructions.