I have a device that had to be replaced (Powerwall inverter).
I want the new device to have the same entity ids as the old ones, so all my automations, scripts, and custom entities keep working (some written in YAML).
e.g. I have binary_sensor.grid_status which changes when the grid goes on/off.
I renamed the old entry binary_sensor.grid_status_old
Now I am trying to rename the new entry binary_sensor.grid_status but I get the error: Entity with this ID is already registered. This is extremely frustrating, since I just renamed the “existing” entity to something else. The name is now available, and I can’t use it.
I also can’t change the old entity back to it’s original name. I get the same error.
Well the whole point of keeping the name is keeping the history…
What I don’t understand is why a new phantom entity is created (with the original name) when I rename an entity, making it impossible to change back? What is the phantom entity?
I should point out, I’m perfectly happy to go and run a SQL script (or edit a YAML or JSON file by hand) to fix this if it can’t be done in the UI. Just not familiar enough with how the schema interacts with the entity registry to figure it out myself.
So I removed this entity from a dashboard it was in, and deleted it from the homeassistant.exposed_entities JSON file, and restarted but it was still showing in the entities list as unmanageable.
Later I checked again on the Android app and it was gone, so I could rename the old entity back.
It’s not clear which thing helped here, but I take it that renaming an entity who’s name you want to keep is not advised - better to delete the existing one it seems?