Lights.yaml all lights unavailable and new duplicates created

Hi
I run HA on a poxmox server, and after I restarted the proxmox server due to a upgrade all lights created using the lights.yaml has become unavailable, and new duplicates with _2 in the name has been created.

Example:

  • platform: switch
    name: Office Desk Lamp
    entity_id: switch.2_floor_office_desk_lamp

Now creates two lights:
light.office_desk_lamp witch is unavailable and
light.office_desk_lamp_2 witch controllers the switch

is there any way to get the units back to their original names?

So I found a workaround.

  1. delete lights.yaml (and keep a copy)
  2. reboot
  3. delete all unavailable units
  4. copy lights.yaml back in
  5. Reboot

This work for me as there is only 5-6 units but is there a more elegant solution for when the number of units is much bigger?