Another WiFi Watchdog

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
wiredcharlie
Normal user
Posts: 57
Joined: 28 Sep 2020, 13:58

Another WiFi Watchdog

#1 Post by wiredcharlie » 31 Jan 2022, 15:46

Problem:
Sometimes ESP falls off the WiFi and needs reseting.

Solution:
Make it reset itself.

How:
Two ESPs on the same network make HTTP requests of each other. The receipt of the HTTP request resets a timer. If the timer expires the ESP reboots.

Code: Select all

 On System#Boot do   
   timerSet,1,60   
 endon

 On System#Boot do   
   timerSet,2,300  
 endon

On Rules#Timer=1 do
   SendToHTTP,192.168.1.23,80,/control?cmd=event%2cResetTimer //This is the IP of the other ESP on the same network
   timerSet,1,60
endon

On ResetTimer do
   timerSet,2,300
endon

On Rules#Timer=2 do
   reboot
endon

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Another WiFi Watchdog

#2 Post by Ath » 31 Jan 2022, 16:10

OT: Your username should be changed to "wireless-charlie" :lol: :lol: :lol:

A few remarks:

- You should combine the 2 "on system#boot do" events into 1
- If you use "looptimerset,1,60" you don't need to set the timer again in the "on rules#timer=1 do" event
- The "on rules#timer=1 do" should optimally be the first one in the file, as it is run the most often (competing with the ResetTimer event) , to reduce rules-processing time

Code: Select all

On Rules#Timer=1 do
   SendToHTTP,192.168.1.23,80,/control?cmd=event%2cResetTimer //This is the IP of the other ESP on the same network
endon

On ResetTimer do
   timerSet,2,300
endon

On System#Boot do   
   loopTimerSet,1,60   
   timerSet,2,300  
endon

On Rules#Timer=2 do
   reboot
endon
/Ton (PayPal.me)

wiredcharlie
Normal user
Posts: 57
Joined: 28 Sep 2020, 13:58

Re: Another WiFi Watchdog

#3 Post by wiredcharlie » 31 Jan 2022, 16:28

Fair

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Another WiFi Watchdog

#4 Post by Ath » 31 Jan 2022, 16:41

You have seen the "Restart WiFi Lost Conn:" setting on the Tools/Advanced page, right?
/Ton (PayPal.me)

wiredcharlie
Normal user
Posts: 57
Joined: 28 Sep 2020, 13:58

Re: Another WiFi Watchdog

#5 Post by wiredcharlie » 31 Jan 2022, 19:15

Ath wrote: 31 Jan 2022, 16:41 You have seen the "Restart WiFi Lost Conn:" setting on the Tools/Advanced page, right?
Yes, but my old Sonoff doesn't like Mega

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests