Creating / keeping backup bin of previous ESPHome version

I just experienced “a fault” on my Sonoff D1 dimmer: after updating FW with V2021.9 lights won’t turn off completely, but they stay at 1%. They work fine with 2021.8. Since i have also a test HA installation (luckily with NOT updated ESPHome) I was able to go back to a previous version, so i have working lights again.
BUT…
Now i’m thinking how to download and keep some of *.bin files when i make a change and update, since i didn’t find a way to “go back” to older version of ESPHome plugin.
One option is: each time i update my module over OTA i “update” again by pressing “Download”. This way i’ll get a file saved on my PC. So, when i’ll update next time i will have an old BIN file to revert in a case of trouble.

But, is there any other, better solution?

It’s probably the only way. The bin file is not stored anywhere (that I can find).

1 Like

I didn’t find it also. I guess it’s somewhere in temp folder and it’s deleted right after flashing.
Ok, maybe i’m paranoic, it happened first time so far. But, i can’t tell what i’d do if i wouldn’t have test HA with old ESPHome plugin installed which solved my problem. I’d live with light at 1% 24/7, i guess… :rofl:

I don’t know if it’s true, but i found out somewhere that installing old version of ESPHome is difficult if not impossible, also HA backup stores only data, not plugin itself.

That is a change in esphome!

Sorry… i don’t quite understand which part you mean by “change”…?

The bin file used to be kept, if it isn’t then that is a change!

You can always generate the bins manually…

I used to do it from my W10 machine

  • install python
  • install the esphome github repository (at the version you want)
  • generate the bin
  • use esphome flasher to flash (or upload using OTA)

@nickrout: Hmm… do you know where was/is this location? It’s certainly not in a “classic” location, that is in ESPHome folder (accessible from HA).
@aceindy : thanks, but from i see it’s easier to click “install” again and select “download”…

It is in the esphome directory, but the last one I have is from esphome 1.20.0-dev (I am on esphome-dev). It was compiled on Mar 26 2021.

It is…it just happened to me i ‘lost’ the bins, so i had to do it and recreate a previous version.
Not that it was a lot of work, since i used that earlier to generate bins from a development forked repository :yum:

Well… I found FW file with WinSCP in a hidden folder “.pioenvs”. But, this hidden folder (and bin file) is present only on some of my modules, while on others it’s missing, although when installing esphome’s log clearly states :

Compiling /data/ales-dnevna-soba/.pioenvs/ales-dnevna-soba/FrameworkArduino/cbuf.cpp.o

But when i look into folder “ales-dnevna-soba” there’s nothing there… only folder “src” and file "platformio.ini. No other ones, not even hidden ones (ls -a). Where, oh where those files hide…?

EDIT: damn… i totally missed dates… all present bin files are dated March 2021. So, after that it seems that location has changed…?

I expect that esphome has started deleting the .pioenvs directory in recent versions.

Either that or platformio has?

You were too fast (and i too slow). I just added above: i missed dates. all present bin files are March 2021

You should be able to spin up a docker with an older version of esphome. does require some docker knowledge, but probably far easier than curating a growing folder full of /bin files…?

Particularly as they are all named firmware.bin.

1 Like

I have HA in Virtual machine, not in docker, if that’s what you mean.
Naming wouldn’t be a problem if files were there as they were before March 2021, since backup names files with hour/date. In a case of need i’d only search in appropriate backup file for correct “firmware.bin”.
Samba backup plugin itself manages only set number of copies on my Synology.

But, i have to find a new location of those files.

I meant running ESPHome in it’s own docker environment. I run mine on a Synology NAS (My HA is on a Pi4 separate)
Using portainer, it’s easy to load up different versions to compile.

Aha… well, i doubt i’ll play with that, i’m not that skilled in programming… i’m more in electronics, soldering… that’s no problem, but what i know about programing is all self-learned (and from nice guys on forum who answers my questions).
Now i did some more searching through whole HA installation (WinSCP search) and didn’t found bin files (only a few old ones), so i gues nickrout is correct: they obvioulsy get’s deleted after installing to save space…

That would make sense since I can do over 20 OTA’s when getting a module sorted (Mostly displays changes), the drive would fill up fairly quickly.
Running Docker is really quite easy, plenty of YT tutorials; once up and running it’s easy to swap out different versions of the ESPhome container to older versions should you need to.

For a YAML config named ‘talos.yaml’ you should be able to find the resultant firmware.bin below the current working directory (or beneath your ‘build_path’, if you included that option) as
./talos/.pioenvs/talos/firmware.bin
(on Linux, at least - the hidden .pioenvs directory on Windows may be named differently)

Creating and maintaining a library of the bin files is its own task. Perhaps a script that copies each one to a folder after compilation and saves it under a different name that includes the date it was compiled.