Ribbit-Network / ribbit-network-frog-hardware

The sensor for the world's largest crowdsourced network of open-source, low-cost, GHG Gas Detection Sensors.
https://www.ribbitnetwork.org/
MIT License
93 stars 26 forks source link

ESP32: Store Wifi Credentials After OTA Update #172

Closed keenanjohnson closed 1 year ago

keenanjohnson commented 1 year ago

Our device will need to store the wifi credentials in a way that they can be saved and reapplied after a device firmware update.

keenanjohnson commented 1 year ago

@akhilgupta1093 are you still up for tackling this?

I just made this post in the golioth forums to see if they had any examples or best practices to look at for this: https://forum.golioth.io/t/store-wifi-credentials-after-ota-update/110

akhilgupta1093 commented 1 year ago

Yes! Thanks for making that post. Doing some general research tomorrow

akhilgupta1093 commented 1 year ago

Hi @keenanjohnson -- the response provided by Jonathan seems to make sense to me. The code that you implemented calls the NVS API to store the provided wifi credentials outside of the firmware. NVS stores other device-specific credentials, like the PSK ID. It seems like OTA updates won't interfere with these stored values, then. What do you think? If you do an OTA update, do you see this behavior?

keenanjohnson commented 1 year ago

Ah interesting. I haven't tried it yet @akhilgupta1093 so I was just assuming.

keenanjohnson commented 1 year ago

As part of https://github.com/Ribbit-Network/ribbit-network-frog-sensor/pull/184, I have validated that this functions.