Page 1 of 1

Rules Global Sync

Posted: 11 Sep 2016, 18:20
by overdrive
Hi,
i want to use the Value form ESPDevice1 in a rule on ESPDevice2.
I set it up and it is working.

But one problem is left, how can i check with a rule in the ESPDevice2, if the ESPDevice1 are still online?

Because without this check, i can't be sure if the value i get from ESPDevice1 is an actuelle value.

Maybe someone can help.

Re: Rules Global Sync

Posted: 13 Sep 2016, 20:40
by Martinus
When data from a remote ESP is received, it will also create an event for the rules engine. I think you could start a timer, set to a value larger than the send frequency of the remote ESP. This timer will be restarted each time the event is received. So normally, it should never reach 0 and fire.

If the timer finished, it means that it was not reset within the specified time window. Meaning that the remote ESP likely had an issue..

Sample that you could try out:
ESP1 has an analog sensor with global sync, taskname "Analog" taskvaluename "Analog".
ESP1 sends data every 5 seconds.
ESP2 receives this through globalsync

Rule on ESP2:

Code: Select all

on Analog#Analog do
  timerSet 1,10 // (re)start timer for 10 seconds
endon

on Rules#Timer=1 do
  help // something wrong, of course the 'help' command is fictitious
endon
But then the next challenge: What to do when this situation occurs...

Re: Rules Global Sync

Posted: 14 Sep 2016, 08:50
by overdrive
Thank you.
It`s funny, yesterday when i was on the way home, i also thought about a timer rule on message receive.

I will try if it works.
For me it is clear what to do. If timer is 1 the relay which switch on something is not allowed to switch on.

Re: Rules Global Sync

Posted: 14 Sep 2016, 12:52
by overdrive
It works.
If the timer is 1 i switch of a relay and switch on a status LED.

Thanks