Page 1 of 1

pulse interval in rules

Posted: 01 Oct 2021, 15:58
by hestia
Hi,
is it possible too get the Interval of a pulse counter a the rules?

Re: pulse interval in rules

Posted: 01 Oct 2021, 22:08
by TD-er
You can let the task send a combined event, of all task values. Then you have the values as shown also on the devices page.

Or you enable monitoring (see: https://espeasy.readthedocs.io/en/lates ... ore-events )
and then when the event is triggered for a state change you can store the time (%uptime_ms%) in a variable and compute the difference.
However you cannot do that at "high" frequencies (over a few Hz) as rules parsing isn't that fast.
Also it may take a while before you process the event, so the timing isn't that accurate. (typical 100 msec resolution at best)

Re: pulse interval in rules

Posted: 02 Oct 2021, 10:24
by hestia
Thanks for your reply
...compute the difference...
seems a bit complicated for what I need: just to avoid hard coding
combined event
seems better but I don't understand how to let "the task send a combined event"
Could you give me some hint please?

Re: pulse interval in rules

Posted: 02 Oct 2021, 14:19
by TD-er
In the task configuration, you can check:
"Single event with all values:"

This will send a single event with all values of the task. See: https://espeasy.readthedocs.io/en/lates ... all-values

Re: pulse interval in rules

Posted: 03 Oct 2021, 10:02
by hestia
In the task configuration, you can check:
"Single event with all values:"
What I understand is that if I check this, for all the task concerned, I'll have a single event with all the values. With witch interval?
I've read this could a good for performance issue, but I don't understand how it will be usefull to get the interval of the device.
Perhaps I wasn't clear...
What I'd like is to use in the rules some values given by Show Json
Screenshot 2021-10-03 095850.png
Screenshot 2021-10-03 095850.png (15.34 KiB) Viewed 5053 times

Re: pulse interval in rules

Posted: 03 Oct 2021, 10:57
by TD-er
Ah OK, then I completely misunderstood your question.
I thought you wanted to get the "period" of the pulse you got from the pulse counter task, did not think of the set "interval" in the task.

That's never been asked before, but I get why you would want that.
For that I guess we need to implement a new variable.
Something like %intervalN% where N is the task index (starting at 1)

Re: pulse interval in rules

Posted: 03 Oct 2021, 11:02
by TD-er

Re: pulse interval in rules

Posted: 03 Oct 2021, 23:00
by hestia
Thanks!