I am wondering how OTA would be realized using MicroPython.
In my mind:
- if connected, the board keeps polling a http endpoint from time to time. Or: receives a trigger via MQTT for example
- downloads a new py script and saves it in the file system
- reconfigures the boot.by to load the new py script instead of the old one. Delete the old one (or save as fallback?)
- restart esp
Again, is there some work ongoing somewhere that I could take a look at?
Cheers
Sven
OTA
Re: OTA
Probably some kind of downloader which downloads new files into a subdirectory in the fs, e.g. "new.d" or something.
Then after all downloads are complete and confirmed, then rename the files.
Otherwise, you'd risk "bricking" the device on an OTA update if it fails half way (or, say, the power fails).
Unfortunately the TLS library doesn't verify certificates, which makes downloading content over http distinctly risky unless you're going to do your own validation of the images somehow in a secure manner.
Then after all downloads are complete and confirmed, then rename the files.
Otherwise, you'd risk "bricking" the device on an OTA update if it fails half way (or, say, the power fails).
Unfortunately the TLS library doesn't verify certificates, which makes downloading content over http distinctly risky unless you're going to do your own validation of the images somehow in a secure manner.
Re: OTA
Best thing is to not bother with TLS at all, as it's slow and ineffective and as has been said and validate it yourself possibly using a secret key and a bit of hashing.