Home Assistant Reconnection / Restart on WiFi loss?

I’ve just returned from holiday and something caused my WiFi to drop while I was away. I’ve not managed to establish what that is but secondary to that is that
even once WiFi was restored I still couldn’t access Home Assistant 6 hours later (I restored WiFi and went to bed)

Only pulling the plug iny home assistant got it to reconnect

I’d really like to be able to resolve situations like this remotely if possible and could ask the person who feeds our cat to reboot the router if needed, but if Home Assistant isn’t going to reconnect then that causes additional issues

_Is there any way to get Home Assistant to retry connections or reboot periodically if it’s not got a connection? _

(I’m wondering if it perhaps does this but increases exponentially with each test which maybe meant that even 6 hours wasn’t enough after 2 days - sadly using a smart plug to ptp on home assistant isn’t really going to work :rofl:)

You could set up a Ping Sensor that tests if a connection to something on the internet is possible. You could then have an automation that restarts HA if this test fails for a period of time.

Having HA connected via WiFi is a bad idea to begin with…
But, if you need to “pull a plug” then having a separate wifi switch (not connected to HA, but directly, say on shelly app, sonoff app or similar) is one of solutions. This switch will (hopefully) reconnect when wifi restores and you’ll be able to “reboot” HA.

Okay so my description isn’t entirely accurate, it’s wired, to a node of my mesh which is also wired. The mesh dropped out, internet connection didn’t.

The problem I have is that the internet/local network for all intents and purposes within the house was down. Oddly I could access my Eufy security which was wired to one node which remained connected, but the other nodes being down failed everything else.

A WiFi non-HA smart plug might, but based on my other devices, wouldn’t have worked

From what I can tell HA didn’t think there was a network at all and there was no way to access the interface

If you use HA OS or Supervised:

  • have a ping sensor
  • use an automation that reboots the host if no ping for say 5 minutes

(service hassio.host_reboot)

I’ve had my share of problems with my network - i have a router and three nodes in Asus AiMesh, and since asus has tons of settings you just don’t know which to alter… I played with various settings until system reached stable state. I used tons of google advices and tried to see if it works…

So, i guess that your local network system has “problems”, so i’d go in a direction to solve them. Rebooting HA wilľ maybe solve HA connection problems, but it won’t save your problems with local network. Either your settings are “odd” or your devices are unstable ( which would mean buying whole new set, which would be very costly).
Just to start: one of potential problems can be “exotic” functions of 2.4GHz, like 802.11ax mode, mimo antenna settings at 2.4GHz, etc… since these settings are not standardízed for 2.4GHz (only for 5GHz) they can cause all sorts of problems. But there are others, so only google will be able to tell them for your router/mesh system.

Thanks. The odd thing is that my network doesn’t have problems - this was the one time it’s happened in 3 years, and I just happened to be away.
My ISP has problems, but that’s a different story

In short, I’m just trying to protect myself for next time it happens (if ever)
The ping sensor sounds like it should work

I’m thinking I might also set up an emergency switch which I can direct the cat sitter to which reboots all my nodes plus home assistant locally in the event of an emergency

Well, in that case you could set up an esp device with 230/10V relay, which would reboot router/mesh, too, when ping doesn’t work anymore…

I also have a mesh with HA wired to one of the nodes. The trouble is, when the connection is lost (which thankfully is rarely) there are so many possibilities that it’s hard to cover all the bases.

I’ve found that simply pinging an external server like Google to confirm that HA is online produces the occasional false positive (or should that be negative?) if the ping times out - for example because of an Xbox download hogging the network.

You can ping the mesh nodes themselves to establish whether they are running, but if one is not, I’m not sure what HA could do about it. I’m uneasy about having basic infrastructure devices like that powered by smart switches.

The DNS IP integration gives you a sensor myip, which will tell you whether your ISP has problems.

I have just started using a service called healthchecks.io which I am still quite enthusiastic about. It works as a sort of dead man’s switch - a HACS integration pings them every five minutes and if they don’t hear from it as expected they send you an email to warn you that there may be a problem.

But again, what do you do? Your cat-sitter needs a big red button that will turn power off and on for the whole house. :grinning_face_with_smiling_eyes:

I’ve put a Shelly before my Pi4 with HAOS on it.

A script on my NAS pings the Pi every hour and when there is no respons it sends a “turn off for 10 seconds, then turn on” command to the Shelly.

That works like a charm.