"Restart On Retriger" task
Grzegorz Kulinski 2 years ago in bOS Configurator / Tasks • updated 2 years ago • 11
I would like to understand how the "Restart On Retriger" function in task "Program" works. I need to run "Program" depending on the change of motion sensor violation bit. I have quite long time delays inside "Program" (between 15 and 45 minutes), so it is very important that at each change of the motion sensor violation (change from 0 to 1 or vice versa) my program is interrupted and restarted. How should "Restart On Retriger" be set in this case? On False or on True?
Customer support service by UserEcho
I forgot to attach a photo.
Did you set as well the "allow retrigger" in your trigger setting ?
For me, "AllowRetriger" and "Restart On Retriger" are two separate functions.
The first one adds the possibility of repeatedly running the program by the same value of the trigger variable (i.e. when the same value comes from the KNX bus many times). In my case, this functionality is not needed, on the contrary, I don't want to run the program again when re-receive the same triggering value. Program should only be run only when motion sensor send different value (ie from "1" to "0" or vice versa). Therefore, in this case I don't use the "AllowRetriger" option.
However, I want each program restart to be preceded by stopping the previously launched instance of the same program so that it doesn't run in parallel.
If anybody can help me, one quick question!
About the "AllowRetrigger" on Triggers, how does it work when you don't activate it?
That program only runs 1 time forever? Or it works only 1 time in a period of 24h (example)?
AllowRetrigger actually acts like a watchdog.
So a quick example for the AllowRetrigger: let's say an alarm status relay (true / false).
If you don't activate the AllowRetrigger, it means that the trigger will only be executed when the value actually changes (from true to false, or from false to true).
But there are a number of situations, where you want to make sure that the function you created will be actually executed, event if it's a retriggered value (for example, the alarm status last value is true, and the bus get's true value again, so it's considered a retrigger, and you want to execute the function anyhow).
Probably is not the best example, but that's the way AllowRetrigger functions, to be able to understand a retrigger even with the same input value, rather that just allowing the only onchange value.
Thank you Ricardo!!
The example is perfect to understand how it works!!
Usually I use the AllowRetrigger on every task I create. Probably it's "time consuming" for the server, but I want to be sure that nothing escapes from entering the tasks I created.
So rather that relying only on the "OnValueChange", I "force" the task to be analyzed everytime the value changes, even if it gets the same value.
I gave you the example of the alarm status, but honestly I think all my tasks have the AllowRetrigger on.
I'm still not sure how "Restart On Retriger" works :) Question in the first post of this conversation. Could someone explain on some example?
A quick explanation is right below the setting on the configurator:
"The Restart on Retrigger setting defines the behaviour of the program execution when program is executed while previous execution is still running."
So basically let's say that:
Your task starts after receiving a certain trigger;
Let's say that the program logic takes some time to execute totally (example: contains timers, or whatever takes time to fully execute the task until the end;
If you don't have Restart on Retrigger, the task will execute and stop in the end, and wait for the next retrigger.
If you have the Restart on Retrigger, let's say that the task is running and still running, but it gets a new retrigger. In this case the task will stop executing, and restart again from the top.
I will find an appropriate example for this use case.
Restart On Retrigger as false: the task will be executed until the end and wait for the next trigger; Nothing can interrupt the task running;
Restart On Retrigger as true: the task will be interrupted, even if it's still running, if it gets a new trigger; The task can be interrupted while running, and start from the top again;
Honestly I never used Restart On Retrigger, but I'm sure I can think of an example later.
This is exactly what I meant and this is how I set up the "Restart on retriger" function. I use it in logic that controls air conditioning and lighting. I have created a quite complex programs that distinguish violation of the motion sensors during office hours and at night time. The purpose of these programs is, of course, reduce electricity consumption. Because operation of these procedures must be invisible to employees, therefore violation times of motion sensors must be quite long (Iset 45 minutes during daytime, 15 minutes at night). The launched program checks several conditions, then starts counting down the given time, checks a few conditions again and finaly performs the target actions (switches AC to economy mode, turns off all lights even when the violation of the motion sensor is blocked by user). This is the reason why I needed to use the "Restart on retriger" feature (to stop a running program while it was restarted).
Thanks a lot Ricardo for the clarification.