Changing entity id gives already in use error

If you change any entity ID at all in Home Assistant at the moment you get a “Already in use” message.

I was able to reproduce this using entity ids ive never even remotely used before on two different systems. I raised it here: Entity ID Already in use regardless of if I've used it before · Issue #3314 · home-assistant/operating-system · GitHub

This is false. I changed a bunch of entity_id’s last night and this did not occur.

There is likely something wrong with your storage registry. Have you been editing it?

It’s not false. I’ve had it occur on two new brand new instances. One supervised, the other on a docker image where I had done nothing but change the single id. More than happy to demonstrate it.

Ok I just tested this:

Before:


.

After:


.

Result:

Logger: homeassistant.components.recorder.entity_registry
Source: components/recorder/entity_registry.py:72
integration: Recorder (documentation, issues)
First occurred: 13:44:44 (2 occurrences)
Last logged: 13:46:47

Cannot migrate history for entity_id `sensor.cinema_window_voltage` to `sensor.cinema_window_voltage_foobar` because the new entity_id is already in use
Cannot migrate history for entity_id `sensor.cinema_window_voltage_foobar` to `sensor.cinema_window_voltage` because the new entity_id is already in use

The entity changes fine and keeps working and recording history though.

I have added this detail to your issue. Apologies for doubting you.

All good, if I’m understanding you correctly, when you say the recording history is working, is it registering the new ID and the log error is entirely false?

It does not bring the previous history to the newly named entity but the newly named entity does start logging it’s own history.

When I changed the entity id back to normal it got all its previous history back except there was a gap in the history when it was recording to the …foobar entity

Alright cool, sounds like I’m good to continue on then, I was about to wait until it was fixed before rebuilding my instance in case it caused issues.

Your issue was closed as you opened it in the HA OS repository. I have created a new issue in the core repository:

3 Likes

Yeah i wasn’t sure where to open it, I asked in the discord but no one responded.