Page 1 of 1

Check if ESP8266 is connected to wifi and activate a relais.

PostPosted: Tue Sep 20, 2022 8:32 am
by giano2002@gmail.com
I am a newbie and find it difficult to write a program for the NodeMCU to restart a router if it hangs.

The program should:
1) continuously check if the ESP8266 is connected to the home WiFi (SSID and PW).
2) when the WiFi is no more connected, wait about 2 minutes and
3) if it is still disconnected,
4) activate a relay (which will turn off the router).
5) After 20 seconds, turn off the relais (so, the router will restart).
6) Wait another 4-5 minutes and if the WiFi is reconnected, go to 1) , otherwise, if the WiFi is still disconnected,
7) repeat from point 4).

I think the program is not difficult, but for me it is. So, is there somebody that could help me? I would be very grateful to him.

In fact, sometimes the modem / router of my mountain home crashes (perhaps when it is remotely updated by the Internet provider or for other reasons) and needs to be restarted. But since I am often not at home, all the devices connected to it (cameras, thermostats, etc.) remain deactivated and it is not possible for me to intervene remotely. Such a program could solve the problem.

Hope to receive some help.

Re: Check if ESP8266 is connected to wifi and activate a rel

PostPosted: Sat Oct 08, 2022 6:38 am
by rooppoorali