WiFi Credentials not Being Saved

Hello fellow Blynkers, after converting my app to Blynk IOT I have noticed that on random and maybe not so random occasions my WiFi credentials that were set up during Device Configuration/Reconfiguration are not being saved. For reference, my ESP32-based code uses the basic Edgent example to login to Blynk and connect to WiFi. I am starting to wonder if this has something to do with Blynk/Edgent disconnecting (and forcing a ESP32 restart) due to WiFi not present. Is there some case where the credentials previously stored (during a normal WiFi connection) would be removed upon reset? Thanks!

My guess is that you have something connected to the pin that is defined as your Blynk reset pin, and this is causing the credentials to be cleared.
Or, you are writing other data to EEPROM in your sketch and this is overwriting the Blynk stored credentials.

For more info about the first possibility, read this…

Pete.

Thanks for the quick reply Pete. My reset pin is solely dedicated to the momentary switch as described in the docs. In fact, I have had little trouble with this until now, where I find that a large number of my deployed devices are “losing” their credentials. One common theme, as i outlined above, is the sometime absence of the WiFi connection. We are using smartphone hotspots and the users sometimes forget to turn them on. Blynk, as we know, will wait a bit for a connection and then reset. I am wondering if during this reset the stored credentials are getting wiped. I do know that Edgent uses a restartMCU() call but assume this is not the culprit.

I will also double check my board type and config but am pretty sure they are correct as I have a few dozen devices working ok. Might also be something going on with the specific ESP32 I am using, the Adafruit Feather Huzzah32. Thanks!

Can’t really suggest much more without more info from you I’m afraid.

Pete.

Ok thanks. Don’t really have much more detail except that I saw in another thread today that pushing the Blynk reset button always precedes the “Add New Device” process which I typically avoid doing more than once. I was under the impression that a push of that reset button could lead to a choice of “Reconfigure” OR “Add Device”. Can you pls confirm that “reset button” only takes you to “Add New Device” and not “Reconfigure”? And if this is the case it presents a new problem for me as I add database metadata to each new device, so if users are doing “Add New Device” to change WiFi connections, for example, then I have to somehow detect and react to this ASAP because “Add New Device” generates a new unique “device” that I have to track down and to get the correct metadata plugged in. Thanks!

You are loosing track. Let me explain.
If you want to add new device you should be in the BlynkIoT app Home page and click on the the lines (hamburger) icon on the top right of the screen(next to the spanner icon)

Now you can click on add device and the app will search for the hotspot created by your new device and configure it for you.

If you want to reconfigure the existing device, you need to go to the device page and click on the three dots on the top right off the screen two times. This will take you to this page

Here if you click reconfigure the device will reboot and turn on its hotspot and the app will connect to it and you know the drill.

If your device is offline and not able to connect to your network, then you need to press n hold the reset button that you have defined in your settings.h tab, this will reboot the board and turns on the hotspot. Now you need to follow the same steps as above to reconfigure…

This way you will only be changing the wifi creds. No new device will be added.

Pushing and holding the button that is defines as the Blynk reset button in Settings.h for 10 seconds will clear the stored credentials from EEPROM. These credentials include SSID, WiFi Password and Auth Token.

It is then necessary to re-provision the device to add these credential in again. A new Auth token will be assigned in the process.

Pete.