Switch only low-voltage loads yourself. For mains loads use a certified isolated module in a box or call an electrician.
Let the box restart the router for you
Routers hang more often than they should, and the usual cure is to unplug them for ten seconds. An ESP32 can do that automatically: it pings two or three reliable addresses, and if all of them fail for several minutes, a relay cuts the router’s power for ten seconds and restores it.
Do not make it worse
Test more than one address, otherwise one server being down restarts your router for nothing.
Wait a few minutes before acting, and wait longer after each restart, so a provider outage does not become a reboot loop.
Limit the number of restarts per day, and send a message when you hit the limit.
Use the relay’s normally closed contact, so the router stays powered if the ESP32 itself dies.
The relay switches the router’s low-voltage adapter or its mains plug. For mains, use a proper enclosed relay module, and keep the wiring clear of the low-voltage side.
Ukraine: we buy and sell these parts ourselves, order them on this site.
Some links are affiliate links: we may earn a commission at no extra cost to you.
Related ideas
⛔ High risk
Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.
Comments
No comments yet. Share your experience or ask a question.