Blynk reconnecting with Wifi Manager

I use in my house a temperature sensor that connects to the wifi network through wifi manager. when the current falls, the router’s time to connect to the internet is much higher than the boot time, then the program creates an AP and the sensor no longer connects to blynk. Q: How can I, after a preset time (say 3 minutes), program go out from AP mode and retry to connect using previously saved data?
I use nodemcu-12E and Blynk server…
Thank you.

wifimanager has a portal timeout function.

Configuration Portal Timeout

If you need to set a timeout so the ESP doesn’t hang waiting to be configured, for instance after a power failure, you can add

wifiManager.setConfigPortalTimeout(180);

which will wait 3 minutes (180 seconds). When the time passes, the autoConnect function will return, no matter the outcome. Check for connection and if it’s still not established do whatever is needed (on some modules I restart them to retry, on others I enter deep sleep)

Example HERE.

Along with full documentation HERE

6 Likes

Thank you Toro_Blanco. It’s working like a charm…