Watchdog for network devices with Tasmota and Sonoff S26

I don’t know how many times I had routers providing access to the internet that would not reboot in case there are problems. Or sometimes the problem is a Raspberry crashing from time to time that I don’t have time to debug.

If it’s the router, the solution would be replacing the router, but it’s not always so trivial. Sometimes you are forced to use your ISP’s router. Sometimes the technology your ISP is using makes very difficult considering an alternative. Remember: here in Spain they sometimes do not disclose connection details or VoIP configuration details. And if you problem is with a Raspberry, you

First advice: if your problem is a router and if you can replace it, go ahead. And consider buying one that supports OpenWrt.

Alternatives

If not, maybe you already considered some options. Ubiquiti’s mFI mPower used to be a nice option and I even still have one. But they are usually expensive and hard to find nowadays, and (worst of all) the firmware is not maintained at all.

NETIO products seem like a nice alternative but well, the only have three products that allow watchdog. The two most interesting for home use are EoL (NETIO4 and NETIO4All) and the third one is a nice PDU (PowerPDU 4C) so you will need adapters.

You could also consider WiReboot, but it seems it’s not available in Europe and I don’t want to mess with customs.

And if you keep looking, you will see more and more alternatives, most of them complex. Because yes, we have “smart” sockets, but it seems that they do not provide this kind of feature.

So if you want to play a little, you can also consider hacking one of such “smart” socket. There are a lot of models and a lot of them are based on the Tuya platform. Ignore those. Changing the firmware can be easy, or just impossible.

Tasmota and Sonoff S26

WARNING: Be aware that you will be working under your exclusive responsibility, and that by doing this you can be violating some local regulations. I do not take any responsibility or liability for following the instructions. Make sure you know what you are doing, and just do not proceed if you are not sure.

WARNING: Never, ever, tinker or try to flash a device using the serial programming interface while it is connected to MAINS ELECTRICITY (AC power).

WARNING: The Sonoff S26 supports a maximum load of 2200W and 10A. Do not connect any devices exceeding that load and do not connect more than one device at the same time.

Go for those with a Serial Port. In my case I considered the Sonoff S26, which accepts Tasmota, and Tasmota accept rules and those can be used to create a watchdog.

So what do you need?

Bonus

As you noticed above, my build included USE_TELEGRAM, as I want to get notifications to telegram when the Watchdog is acting:

Rule1
ON system#boot DO Var1 3 ENDON
ON system#boot DO tmchatid <MY_TELEGRAM_ID> ENDON
ON system#boot DO tmstate 1 ENDON
ON system#boot DO tmtoken <TELEGRAM_BOT_API_TOKEN>
ON Var1#State>1439 DO Var1 1439 ENDON
ON Time#Minute|%var1% DO Ping4 192.168.1.1 ENDON
ON Ping#192.168.1.1#Success==0 DO backlog Mult1 3; tmsend Unresponsive router: restarting power; Power1 0; Delay 10; Power1 1 ENDON
ON Ping#192.168.1.1#Success>0 DO Var1 3 ENDON

Then I enabled the rule and rebooted:

Rule1 1
Restart 1

And ready!

Keep in mind <MY_TELEGRAM_ID> is not your alias or your phone number. You can use a bot to get your ID.

And the <TELEGRAM_BOT_API_TOKEN> can easily be retrived from Telegram’s Botfather bot.

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.