Bell Fibre Internet is awesome however the HomeHub 3000 router they provide is rubbish. Recently we were away from home when there was an internet outage requiring a router reboot fix.
Our home is smart so losing Internet while we’re away caused a few problems;
- The front door camera was not accessible so we couldn’t check if packages had arrived
- The thermostat was not accessible so we couldn’t warm the house before we got home
- The Plex server (self hosted Netflix) went down and I had to read a book
- We couldn’t run the vacuum cleaner prior to our arrival or drive it around the house to check for post storm damage
After a bit of research I decided on the Watchdog for Wi-Fi router approach with a few tweaks. I built a version of Tasmota with USE_PING, USE_EXPRESSION, & SUPPORT_IF_STATEMENT enabled. USE_PING allows me to write Tasmota Rules based on the response of network pings. USE_EXPRESSION, & SUPPORT_IF_STATEMENT were added in case more complex Rules were required later. For instance, adding the ability to ping multiple servers to check for network connection. I flashed a Sonoff switch with my build of Tasmota version 9.1.0 using Tasmotizer. Then connected the switch to my router’s wifi network and in line power supply.
In the console;
Set the PowerOnState to 1 so that the router would turn on after a power outage
Then added a rule which sends 8 pings to 1.1.1.1 every 120 minutes and if there are 0 successful responses, it powers off the router for 15 seconds, then powers it back on. I choose a 2 hour cadence because a 2 hour outage is fine for my use case and I didn’t want to risk a reboot loop if 1.1.1.1 stopped responding to my pings.
Rule1
ON Time#Minute|120 DO Ping8 1.1.1.1 ENDON
ON Ping#1.1.1.1#Success==0 DO Backlog Power1 0; Delay 150; Power1 1; ENDON
Finally I enabled Rule 1.
I’ll try this approach out for a while and if reboots become too frequent I will use the USE_EXPRESSION, & SUPPORT_IF_STATEMENT to check multiple sites before initiating a reboot.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
- ---
title: "Automatically reboot router on lost Internet connection with Sonoff switch and Tasmota"
description: "I flashed Tasmota onto a Sonoff switch so it automatically power-cycles my router when the Internet drops."
author: Greg
layout: post
permalink: /2020/12/router-rebooter/
date: 2020-12-06 18:12:48 -0500
comments: True
licence: Creative Commons
categories:
- technology
tags:
- automation
search_terms: [bell, bell canada, bell fibre, fibre, fiber, home hub 3000, homehub, isp, modem, wifi, wi-fi, internet outage, outage, downtime, uptime, power cycle, restart, reset, watchdog, ping, rules, tasmotizer, firmware, custom firmware, poweronstate, console, cloudflare, smart plug, smart switch, relay, iot, home automation, smart home, it crowd, turn it off and on again, plex, netflix, media server, self-hosted, self-hosting, thermostat, door camera, security camera, robot vacuum, vacuum, remote access, networking, troubleshooting, diy]
- ---
Bell Fibre Internet is awesome however the HomeHub 3000 router they provide is rubbish. Recently we were away from home when there was an internet outage requiring a router reboot fix.
<p align="center">
<img width="80%" height="80%" src="/wp-content/uploads/2020/12/have you tried turing it off and on again.jpg" alt="Have you tried turning it off and on again. IT Crowd" title="Have you tried turning it off and on again. IT Crowd">
</p>
Our home is smart so losing Internet while we're away caused a few problems;
- The front door camera was not accessible so we couldn't check if packages had arrived
- The thermostat was not accessible so we couldn't warm the house before we got home
- The Plex server (self hosted Netflix) went down and I had to read a book
- We couldn't run the vacuum cleaner prior to our arrival or drive it around the house to check for post storm damage
After a bit of research I decided on the [Watchdog for Wi-Fi router](https://tasmota.github.io/docs/Rules/#watchdog-for-wi-fi-router) approach with a few tweaks. I built a version of Tasmota with `USE_PING`, `USE_EXPRESSION`, & `SUPPORT_IF_STATEMENT` enabled. `USE_PING` allows me to write Tasmota Rules based on the response of network pings. `USE_EXPRESSION`, & `SUPPORT_IF_STATEMENT` were added in case more complex Rules were required later. For instance, adding the ability to ping multiple servers to check for network connection. I flashed a [Sonoff](https://www.itead.cc/smart-home/sonoff-wifi-wireless-switch.html) switch with [my build of Tasmota version 9.1.0](/wp-content/uploads/2020/12/tasmota-9.1.0-USE_PING-USE_EXPRESSION-SUPPORT_IF_STATEMENT.bin) using [Tasmotizer](https://github.com/tasmota/tasmotizer). Then connected the switch to my router's wifi network and in line power supply.
In the console;
Set the PowerOnState to 1 so that the router would turn on after a power outage
```
PowerOnState 1
```
Then added a rule which sends 8 pings to 1.1.1.1 every 120 minutes and if there are 0 successful responses, it powers off the router for 15 seconds, then powers it back on. I choose a 2 hour cadence because a 2 hour outage is fine for my use case and I didn't want to risk a reboot loop if 1.1.1.1 stopped responding to my pings.
```
Rule1
ON Time#Minute|120 DO Ping8 1.1.1.1 ENDON
ON Ping#1.1.1.1#Success==0 DO Backlog Power1 0; Delay 150; Power1 1; ENDON
```
Finally I enabled Rule 1.
```
Rule1 1
```
I'll try this approach out for a while and if reboots become too frequent I will use the `USE_EXPRESSION`, & `SUPPORT_IF_STATEMENT` to check multiple sites before initiating a reboot.
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEESYClA57JitMYg1JBb8nUVLEJtZ8FAmr0r8kACgkQb8nUVLEJ
tZ9LTw/9Hr61pK8ZeOVW2FDRurruOE9trbtzJ1VdvxWwNYJosjKi1HQVJzJIyY37
V1IUF8sYJ5lmqTpE9WSIMq5Wb6ZkWyoTBk9IpXXg9AM0+49t3Yyt7ok4YsfQnCvl
/J6BVFl+f+bQwWoB9MLUc37JiLG7UlHBu9lL6zxIFtr4qE1qTsGafnTBNCbzH5PG
Ob1DyQVmBtUnUfSN0OFlJvKYpDrgIC+UJgxxs7h4/iTPbes0bBQf0hhcCPj29c6a
oAoAWkGaD5LMyWHf9t+I3KMSwzb+ggAEuBVEYHfv2Y2KSAhSM3mXyB1HlaYMUxFV
3gQr60L12ReV1RD1noiBGoCc176pIPbRbHKAkARkbcQWGIcFdkAm2AF3llX7XO+w
y43lQsP6e3/GvnSi3CYvPg70ymaMqw0AJgOySns2f3692+mte99aPTGaABuk2DOj
OQtTK0xfSWqGV/4JiE48E+NbgEQWGpsfDpRTD3TDiqTggi4L/AoVRftMj2cwtyYW
jO0+2jnPfXRlzAaf31cv9IFwTog3ladVWeEck9kJDgfMW2SMhDgS6o87hNFsMQqU
pv9RdfgDiGwqDIkUozhFJwP4H2TcK5S5wkPOu4Y93+O4bjudiNoFZTIMYJtBFeKr
VrtdzsCQH6NEPX6vYxGS2k/hu9jYFKRAqozkOEOFkWh39iNQfJk=
=m0dg
-----END PGP SIGNATURE-----