Why does an entity ID become _2 without touching it?

This is the second time this has happened and I don’t know what’s going on.

I updated HAOS and upon restart one of my automations throws an error. Somehow “dining_room_light” is now “dining_room_light_2”. (WHY??)
So I edit the automation changing dining_room_light to dining_room_light_2, save it and restart HA.
The automation is still throwing the same error: dining_room_light is an invalid entity.

??

I open the automations.yaml file and search for “dining_room_light”. And I find TWO copies of the automation there. One correctly identifies the entity as “dining_room_light_2” and the other still has the old entity name: “dining_room_light”

??

Can anyone help me understand what is happening here?
Why did my “dining_room_light” become “dining_room_light_2”?
Why are there two copies of the automation?

It’s as if editing the automation to update the entity name created a new copy of the automation, leaving the original in place.

Note, this automation has been working fine for months until today.

Because the integration controlling your light was set up or discovered again.

That’s just the problem- I hadn’t touched the device (it’s running ESPHome) for months. Then it’s suddenly _2.

What type of light is it (which integration or platform)?