How can I restore a device from yaml backup?

Somehow I lost almost all my esphome devices in the dashboard and HA. Fortunately I have some backups of my yaml. What would be the preferred way to restore my devices? Would I need to use WebConnect and recreate the device, then manually copy over the relevant yaml?

If you dont have backups of the original config files for each one, that still shouldn’t stop your devices from being discovered and usable through HA. The only problem with that is if you dony have the yaml file, you wont be able to change anything on those esp nodes unless you redo them and flash new configs on each board.

There are multiple ways to backup HA files but, me personally I started using the add-on Syncthing which is a automatic backup tool that lets you backing HA files to another device on the network and it frequently scans both locations and checks for file discrepancy like if door.yaml in HA was 5kb and the copy of door.yaml on my pc is 4.7kb then it will automatically make a updated backup of the HA file and update the smaller file thats in my backup location so those files are always up to date with the currrent esphome iteration im using for any particular board and if i hsd to restore them, i wouldn’t have any lost edits to go back and fix.

The reason i do this is because I manage around 50 esphome nodes and am frequently editing things and i dont do full or even partial HA backups frequently enough and a crash or loss of esphome files would be a whole bunch of headaches trying to remember what i changed on each node and manually edit them to add whatever was lost… I just got a headache thinking about that!

Syncthing handles the reliable backing up of those files so that they stay up to date between each HA full backup and eliminates any risk of being in your shoes and having to flash a bunch of devices again because, i have been there and it flipping sucks, you have my sympathy bud!

If you have copies of your esphome yaml’s just copy all yaml files in esphome folder. Then when you’ll open esphome dashboard they will be there.