How to prevent same entity to be created again, but with _2 after name?

I somehow keep fiddling with my HA (currently on a RPi4). I’m using the ‘manual installation’.

Far too often, i end up with entity-names with a _2 as last 2 characters in the name. Somehow an entity i already had configured, gets created again.

I end up going through all YAML files to see where i referenced that entity (mainly lovelace, automation, groups, configuration), and change all references to include the _2.

Any tips how i can prevent this, or what the best way is to deal with this?

Depending on the integration, you may be able to delete the old one and then rename the new one as explained here.

Thank you, i will try that. But just fyi: i for instance have 4 ‘smart plugs’ (GoSund), that express about 11 entities per smart plug (amp, v, wifi, blue button, red button, ssid etc), which all get a _2 appended upon ‘double’ discovery. So while your method works, it’s just slightly less work. Would be great of there were even better solutions. I assume i’m not the only one with this effect :-).

Same issue on my ha instance. a bunch if input_booleans just got updated with “_2” and some automations stopped working because of that.
Any idea how to revert this renaming?

@danielmihalache1983, never seen input booleans getting an increment number will have to look out for that, any idea of the circumstances ?

@raoul.teeuwen, a manufacturer sets default names for their devices an attributes. When you add a node this is what appears. What you should do is immediately rename it and its attributes to how it will be utilised so switch.fibaro_smartswitch_fgs912 gets to be called switch.office_coffee_maker and all its associated attributes (sensors and the like including the one the really matters zwave.fibaro_smartswitch_fgs912.
This is a pain but you HAVE to do it or the next switch you add will just have the same name (except the names have to be unique) oh well I’ll just stick a 2 at the end then.
We’ve all been there.

@Mutt not really, my wife just reported me that some automations stopped working and when looked into that I noticed the renaming.
I also tried to delete entities from .storage and then delete input_boolean from config then added back with original name. they were still created with _2

That’s weird, can you post your config ?

Issue fixed. I was running an older version 0.100.3
Updating to latest 0.104.2 fixed this issue.

I just experienced the same issue (with input Booleans). I assume it happened when I ran a different HA version with the same configuration folder.

  1. Running system with HA 103 release.
  2. Set up dev system with HA 105, run it.
  3. Switch back to production system on HA 103.

All systems live in a venv.

PS. Deleting core.entity_registry and restarting HA fixed it, though.

1 Like