[quote=“RichardTSchaefer, post:19, topic:180469”]In MCV a timer is created when you call luup.call_delay(“SomeFunctionName”, DelayInSeconds, “SomeStringArgument”)
Once you call this function there is no way to stop it.
[hr]
PLEG uses the name of the PLEG timer as the “SomeStringArgument”.
In PLEG a timer is a Named Object, that knows about StartType, StopTypes, Intervals, …, and, a variable I call “StopCnt”.
Ultimately the PLEG Timer is implemented with the MCV luup.call_delay function.
The StopCnt is not related to the delay … it just indicates that I called luup.call_delay for that specific PLEG timer.
If you call StartTimer multiple times before the timer has actually expired … then StopCnt increases from 0 initially to 1, then 2, then … N where N indicates there are N outstanding timer requests for this particular timer.
When you call StartTimer, it looks up the PLEG Counter using the name, and then Increments StopCnt before calling luup.call_delay.
When the timer finishes, Vera calls the “SomeFunctionName”. For me that function looks up the PLEG Counter, Using the CounterName, then decrements the StopCnt.
Only when the StopCnt reaches zero … do I really execute the stop behavior. The termination of the other counters only decrement the StopCnt.
i.e. When Vera finishes the timer, it calls my function. My function decrements the “StopCnt” from N, to N -1, … ultimately to zero where N indicates there are N outstanding timer requests for this particular timer. Only when it gets to 0 do I consider that the Logical Timer has actually expired.
[hr]
I guess I need a NON programmer to describe this in a manner suitable for non developers.
When the delay is always the same … the appearance to the end user is as you indicated. I.e. it appears to just reset.
But when you have different intervals passed to StartTimer, while the timer is running … the illusion is shattered … that’s why I felt it was important to understand the behavior.
The example I used before might be considered an unanticipated behavior.[/quote]
Actually, reading your text between the horizontal lines and then rereading your original statement helped a bit. So are the multiple “resets” additive?
For instance, I call a 00:10:00 timer and let it run for two minutes. I’d therefore have 00:08:00 left on the original timer call. At that two-minute mark, I call the same timer for a different condition/value (say 00:15:00) due to a motion hit. Does that mean that I will have to wait for 8+15 = 23 minutes? Or, does the 15 minute call just increment your StpCnt variable and do nothing as far as delay is concerned. Then only having to wait the original 8 minutes?
Or do the timers run in parallel? Therefore both 8:00 and 15:00 would countdown together? Making you wait a total of 2+15 = 17 minutes?