Internet router power reset if fails

My internet router hangs from time to time and neither the internet nor wifi is working.
By interrupting the power supply, everything works again.
To automate this, I have created an automation in Homeassistant that switches the router off via a switch socket connected to the RasPi wlan0 in the event of a router- or internet failure and switches it on again 10 seconds later.
see:
https://github.com/wavoigt/HA-Router-Reset

I think it’s great that you found a solution for your problem.

I learned something here, the ability to ping a device from HA.

I would recommend that you find out why your router is locking up. I had problems with mine and found that it could only handle about 20 WiFi connections. The router gave no indication of this problem, but reseting it fixed it … temporarily. I found an access point that can handle ~300 WiFi devices, though it was very difficult to configure (Ubiquity)

If your router support SSH (or telnet), and the device is still responsive (but just needs a reboot) you could try something like…

No external device needed :stuck_out_tongue:

If at all possible, get a new router. That’s not normal. My Ubiquiti routers (USG from 2018 until last year, UCG Ultra now) never hang; and the same is true for other decent kit.

1 Like

I took an old PC I had laying around at put opnsense on that. SO HAPPY i did.

unifi is easier to manage however.

It should not be common enough for there to be a need to reboot your router. 1.) Check the firmware and update it, if needed.
2.) Your router is failing and needs to be replaced.

I have a very simplistic way of fixing my system.

My router/modem is all one unit. I have it plugged into a Zigbee plug. HA checks two different Wifi connected devices to see if they are unavailable. If they are both unavailable, HA will run an automation to shut off the Zigbee plug for 10 minutes and then turn it back on to reset my router. I tested it by disconnecting the cable going into my modem to ensure the devices turned unavailable. Worked like a charm.

Full disclosure… even though I have this automation built, it has never run (according to my logs) besides when I tested it. It is a “just-in-case” automation.

It is a half year old Fritzbox 6670. :sweat_smile:
It was hanging 2 times, last time when i was in holiday and no one was at home to pull the mains plug.
There is also the possibility to do a automatic soft reset from Home Assistant, but i’m not shure if it is responding to a soft reset in case of hanging.