Home assistant restarts when ethernet goes down?


I made a automation to restart my router if a sensor fails to ping google.

The sensor pings every 15 minutes:

  - platform: ping
    name: ping_google
    scan_interval: 900

The automation looks like this:

alias: Restart router if ping fails
description: ''
  - platform: state
    entity_id: binary_sensor.ping_google
    to: 'off'
      minutes: 1
  - service: switch.turn_off
        - switch.11
  - delay:
      seconds: 10
  - service: switch.turn_on
        - switch.11
mode: single

This resulted in Home assistant turning off the router but not turning it on again.
I also noticed that when manually starting router again it looked as if home assistant was starting up when connection came back again.

Is there a feature that turns off home assistant and powers it back on again when network is restored?

Once you turn off your router home assistant will be unable to communicate with any network devices, so it won’t be able to turn the router on again if it is a wifi connected switch.

What sort of switch is this?

There are queued commands you can send to Tasmota switches. So you can send a “turn off / delay / turn on” all in the one command. That should work.

See https://tasmota.github.io/docs/Commands/#the-power-of-backlog if you are using Tasmota.

1 Like

What kind of switch are you using to control the power? How is HA connected to that router? It may be you need an intermediate switch so that HA does not lose its IP address. If it’s rebooting, you should be this in the home assistant log files.

I’m considering doing the same as recently I’ve had to do some manual router resets to restore internet connectivity.

I assume you are using a WiFi plug ? Better use a Zigbee, Z-wave or even a Kaku plug to turn your router off and on. Or as Tom said, a WiFi plug flashed with Tasmota. If your router is the only WiFi access point, there is otherwise no possibility for it to reconnect to your network.

Sorry, forgot to say I’m using 433 mhz switch and telldus duo connected with usb to HA.
So switch should work without internet connection.

HA is connected with Ethernet and has fix IP set in booth HA and router.

I’m travelling a lot for work and it happened in January that internet failed and my dad had to go to my house and reboot router.
After that I made this configuration but I did not have time to test it properly.
Just started a 6 week trip and internet went down again.
Dad had to remove the 433 switch so for now I just hope the ISP wont break the internet again :grimacing:

I used VPN and connected to home router and restarted it remotely.
HA did not restart :face_with_raised_eyebrow:

I have another theory what could have gone wrong.
Tellstick duo is set to repeat 9 times and this could take longer than the delay of 10 seconds.
If you then call a new service to power on maybe it does not que up and send turn on 9 times and then it continues and sends last repetitions of turn off?

Maybe faulty 433 switch.
I doubt that signal did not get through to power on since it’s only a few meter but theoretically it could be possible.

Will troubleshoot more when I get home in middle of May

    host: core-tellstick
    port: [50800, 50801]
    signal_repetitions: 9

Just a follow up on this, HA will restart if ethernet goes down (after about 15-20 seconds).
This is a “Home Assistant operating system” installation on a Raspberry PI 4.
The base operating system does not restart but “Home Assistant Core” go down and start up again once ethernet is restored.

Not sure if it has any effect but “WLAN0” is disabled.
Ethernet IPv6 disabled.
Ethernet IPv4 set up with static IP on booth router and in HA.

If I unplug ethernet for about 15-20 seconds then HA will have restarted when I reconnect network cable.

You have many cloud based integrations ?

What do the logs say happened?

10 cloud based and 14 local

What log should I check?
I checked quickly but did not find any information about why HA was shut down.
Only thing I could see was information about the startup and “Home Assistant Started” in the end.

From the “Uptime” integration I also see that HA restarted but underlying operating system did not restart.

Are they all ‘official integrations’, or some custom ones ?

I have some custom once from HACS.

This is originally a “hassio” installation from 2017 that was backed up and restored on a RP4 about half a year ago.
So there could be some different settings hidden somewhere that could have an effect too

home-assistant.log.1 is the log from HA’s previous run. That is the log that will contain any errors that caused your system to restart. You probably just need to look at the last few lines of the log.

I need help on something really close to this topic. I can restart my router using Telnet and after insert the User & Password I just need to send the the command “system reboot”. I run HA in a Synology NAS using docker. The question is: is there any away to do this?

Not from Home Assistant if it is disconnected from the router.

Sorry I didn’t explain it in a clear way . The Sinology NAS it is wired to the router and I wanted to reboot the router when it looses access to the internet. So far I found a custom component called pyscript that allows import libraries and a python script with the Telnet command might work.