Giter Club home page Giter Club logo

tasmotarules's Introduction

Tasmota rule for safe router reboot

My brother got a house in Spain, so he asked me to figure out a way to automatically power cycle the router if internet gets stuck. My solution was a Shelly Plug S, flashed with tasmota. That allowed me to set up a rule to ping a couple of IP addresses and do a power cycle after 3 failures. Script will also start with checks every 20 minutes (power cycle would happen 1 hour after failure), but will increase in case of failure all the way to 480 minutes (one power cycle per day). I wanted to do that in case router is updating or something and I do not want to cut power when that is happening.

Rule example is here:

Rule1 
  ON system#boot do Var1 20 ENDON
  ON Var1#State>480 DO Var1 480 ENDON
  ON Time#Minute|%Var1% DO Ping4 1.1.1.1 ENDON
  ON Time#Minute|%Var1% DO Ping4 8.8.8.8 ENDON
  ON Ping#1.1.1.1#Success==0 and Ping#8.8.8.8#Success==0 DO Add2 1 ENDON
  ON Var2#State==3 DO backlog Mult1 2; Var2 0; Power1 0; Delay 150; Power1 1 ENDON
  ON Ping#1.1.1.1#Success>0 or Ping#8.8.8.8#Success>0 DO backlog Var1 20; Var2 0 ENDON

tasmotarules's People

Contributors

ilatvala avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.