ESPHome integration doubles devices if updates are available?

I had it now with in a month two time that my ESPHome devices where not availabe anymore in HA.
I know think that I found the trigger for that. It appears that if there is an update for ESPhome, the devices in the HA integration double. For example:
before: bed_light (1 device, 2 enties), room_light (1 device, 2 enties)
after: bed_light (2 device, 2 enties), room_light (2 device, 2 enties)
I need to delete them then from the integration and restart HA. after that reintegrate the devices and all is good again. But Because this is now the second time that this happend, it must be a bug and not a singularity right?

Best regards from germany,

This usually happens when the sketch on a previously deployed node is significantly changed. The last 2 upgrades to esphome had firmware that needed to be pushed to existing nodes. Perhaps this was the cause.

Esphome creates a config file for each node in the .storage folder of your home assistant install. If you sort by recently modified the current config files will be on top. They do not have the same name as your nodes.

You will need to open the files and compare the config to your deployed nodes. First delete any copies in the esphome integration if any. Then delete any copies in the .storage folder and restart.

You should also backup your sketch files. In general, if a sketch is ever lost/deleted there is no way to get the config off the node.