espressif / esp-rainmaker

ESP RainMaker Agent for firmware development
Apache License 2.0
432 stars 145 forks source link

Wifi Reconnect Issue (MEGH-3995) #194

Open b4sudhir opened 1 year ago

b4sudhir commented 1 year ago

How to call WiFi reconnect method manually as WiFi reconnect not working properly. Even after internet goes (WiFi is connected but no wan) in that case also some time mqtt reconnect but some time it didn't reconnect automatically ... and need force restart of esp in both the cases.

sanketwadekar commented 1 year ago

Hi @b4sudhir, are you using Rainmaker with Arduino or with ESP-IDF? If you are using Arduino, you can call the reconnect() function provided in the WiFi library. Example snippet:

if (WiFi.isConnected() != true) {
    WiFi.reconnect();
}

You can read the docs here.