Esphome code lost

I have a small problem.
A few years ago, I built a small cabinet with various lights.
These can be operated both on the cabinet using a switch and via HomeAssistant.
I programmed the whole thing with esphome and then integrated it into HomeAssistant using a plugin.
That also worked brilliantly.
Recently, my HomeAssistant hard drive broke and I realised that I hadn’t made a backup of the esphome code.
Although I can integrate the device into HomeAssistant, I can no longer access the code to make any changes.
Is there a way to read the esphome code directly from the device?

No

Did you make a backup of the /config directory?

That is where the esphome files are. /config/esphome

but that’s blatant and surprises me somewhere too

Unfortunately not, I had the backups on the same SSD and it is no longer readable.

Linux has a lot of recovery tools. There are specialty distros. Worth a try.

Then again the device doesn’t sound too complex. Can you recreate it?

I’ve often thought it would be useful to copy the yaml to the esp, but haven’t looked at the space implications.

Try reading it with this:

Theres some good external backup options like the Google Drive add-on. Best option may depend on your set-up.

Many of us learnt this the hard way.