Reboot router when Internet is DOWN - Xiaomi plug

Tags: #<Tag:0x00007f32815903e8> #<Tag:0x00007f32815902a8>

Hi all !

I often have my Internet box that lost the Internet connectivity and I have to physically disconnect / reconnect it …

I want to do this with a connected Xiaomi Plug (recognized in HA) automatically.

I am thinking of doing this:

  • ping of 8.8.8.8
  • If down for 5 min
  • Switch off the Xiaomi plug
  • Wait 30 seconds
  • Switch on the Xiaomi plug

But I can’t figure out how to do it.

For information :

  • My internet box is used as a modem
  • All LAN network is managed by Firewall
  • WiFi is managed by two Access points

Thanks in advance !

Create a ping binary sensor that pings 8.8.8.8. Create an automation that turns off the plug, waits 30 seconds and turns on the plug whenever the binary sensor changes to ‘off’. The default scan interval for the binary ping sensor is already 5 minutes.

Thank you for your quick reply !

But I don’t find the ping binary sensor.

I used HA CORE version, is it compatible ?

You don’t have to find it you have to type it in your configuration.yaml.
@Burningstone already posted a link on how to do it.
(you have to restart HA after you have made changes to your configuration.yaml)

1 Like