What would be the best way to initialise a Timer here, so I am certain that while working automatically, it is allways initialised. I modified the initialisation from above, since I think this may be better:
On Power2#state=1 Do RuleTimer2 1110 Endon
Point is: after a router is cycled Off and back On, prime the RuleTimer2 so if the router never sends a heartbeat after it was restarted, it will be cycled again.
Normally, Power2 is always On and PowerOnState=3 but I think I will change to: PowerOnState=1. Any of the following scenarios should trip/check Power2 to On and initialise my RuleTimer2:
- after Tasmota executs the rule to kill and restore power to my router
- when I manualy restart a Sonoff
- when Sonoff returns from a completely unplugged state
- restart because something went wrong and a watchdog cycled Sonoff
If I turn the rule (I mean the complete set from above, not just this segment) manually Off and back On, RuleTimer2 will not arm itself automatically - good for temporary disabling it until a heartbeat starts it again.
I think there is no scenario #5 where initialisationon should be executed. Am I right?
Now I feel I am mostly comfortable with the rules. But, some things need experienced mind :)