- My goal is: In case my internet connection goes down and comes back again, I want my device to re connect.
- My actions are: I have properly configured WiFi and I device token properly. Once I started the device I could see it online in mDash. I have tested it using couple of scenarios.
- I disconnected wifi router power supply for 30 minutes and then powered it on, as soon as this happened, NodeMCU blinked for few seconds and then it got reconnected properly
- I kept router powered on and disconnected the LAN cable so that there was only WiFi connection but no internet, and after this I again reconnected LAN cable and again after some time NodeMCU got back online again.
I have defined sta configuration in mos.yml as follows.
- [“wifi.sta.ssid”, “ssid”]
- [“wifi.sta.pass”, “pass”]
- [“sys.tz_spec”, “UCT-5:30”]
- [“dash.enable”, true]
- [“dash.token”, “my token here”]
“sta_connect_timeout”: 30 (This was generated in conf0.json )
- The result I see is: NodeMCU got offline suddenly after some time and its trying to reconnect to WiFi, however, it is not able to connect even though there is a stable internet connection now.
- My expectation & question is: I expect NodeMCU to try reconnecting as soon as it gets disconnected from network. Do I need to configure something else? What can I do to keep my NodeMCU connected to internet as soon as it is available? I do not want to restart or reset NodeMCU manually.