Intervals ? "Self Retriggering Timer" ?
-
Hi
I am looking to create a rule that will run its actions every x minutes whilst I have a particular light turned on.
As a test I created a rule with:
Trigger - Light is turned ON
Condition (Constraints) - Interval 1 minute
Action - Send a TTS that says "One Minute"
When I first turn on this light the rule then becomes true.
On the rules summary card it says its waiting for the next minute and I can see it flashing green every minute, so the interval timer appears to be working OK
However the action "Set Reaction" is never run every minute as I wanted. In fact the action never ran at all and I never heard a TTS announcement.
I have either set this up completely wrong which is more than likely or its a bug ?
My end goal is to have a rule that runs some LUA code every 15 minutes when I turn on a particular light.
Thanks
-
Hi
I am looking to create a rule that will run its actions every x minutes whilst I have a particular light turned on.
As a test I created a rule with:
Trigger - Light is turned ON
Condition (Constraints) - Interval 1 minute
Action - Send a TTS that says "One Minute"
When I first turn on this light the rule then becomes true.
On the rules summary card it says its waiting for the next minute and I can see it flashing green every minute, so the interval timer appears to be working OK
However the action "Set Reaction" is never run every minute as I wanted. In fact the action never ran at all and I never heard a TTS announcement.
I have either set this up completely wrong which is more than likely or its a bug ?
My end goal is to have a rule that runs some LUA code every 15 minutes when I turn on a particular light.
Thanks
@cw-kid @cw-kid The Interval condition is an "old" way of doing what the "Pulse" output mode of condition options does better. For your purpose, you can have a single condition that checks if the light is on, and put it into pulse output mode under options, with repeats. The condition will produce true pulses while the light is on, and stay false when the light is off. The Reaction will run accordingly.
An interval cannot be used as a Constraint, at least, not like you've done it, because it naturally produces very short pulses (10 millisecond, in fact), so in order for your condition to work, the light would have to turn on during the 10ms pulse. Remember, constraints are only evaluated at the instant the trigger conditions attempt to set. If the constraints allowed the rule to run after the triggers became true previously, then they would not act like constraints and just act like more conditions in an AND group with the triggers.
FYI, the pulse mode output also produces 10ms pulses naturally, so they are very hard to see in the UI. You can stretch them out by wrapping the condition in a group with a "delay reset" option of 1-2 seconds (or however long you want to watch).
Ref: https://reactor.toggledbits.com/docs/Condition-Options/#output-control-options
-
@cw-kid @cw-kid The Interval condition is an "old" way of doing what the "Pulse" output mode of condition options does better. For your purpose, you can have a single condition that checks if the light is on, and put it into pulse output mode under options, with repeats. The condition will produce true pulses while the light is on, and stay false when the light is off. The Reaction will run accordingly.
An interval cannot be used as a Constraint, at least, not like you've done it, because it naturally produces very short pulses (10 millisecond, in fact), so in order for your condition to work, the light would have to turn on during the 10ms pulse. Remember, constraints are only evaluated at the instant the trigger conditions attempt to set. If the constraints allowed the rule to run after the triggers became true previously, then they would not act like constraints and just act like more conditions in an AND group with the triggers.
FYI, the pulse mode output also produces 10ms pulses naturally, so they are very hard to see in the UI. You can stretch them out by wrapping the condition in a group with a "delay reset" option of 1-2 seconds (or however long you want to watch).
Ref: https://reactor.toggledbits.com/docs/Condition-Options/#output-control-options
@toggledbits said in Intervals ? "Self Retriggering Timer" ?:
For your purpose, you can have a single condition that checks if the light is on, and put it into pulse output mode under options, with repeats. The condition will produce true pulses while the light is on, and stay false when the light is off. The Reaction will run
Done that:
I can see it pulsing on the rules summary card.
So the action should be run every time it pulses right ?
I've only heard the TTS once. So the action has only run once.
-
You also have a small bug? In the Pulse if you actually enter 0 in the box that says "seconds,
up to - times (0/blank=no limit)" and save the rule.When you go back in to that area later the 0 has gone and its blank.
I know blank and 0 is the same thing, but as I'd manually entered a 0 in there I kind of expected it to still be there.
Not a big issue at all just thought I'd mention it.
-
No, you can't put the pulse in the Constraints either. You've got it backwards, and since the two conditions are the same, you don't need the Constraint at all, because pulse mode output has the built-in constraint you want: it only pulses when the condition test is true.
You should have a single trigger condition for your light entity is TRUE with pulse output configured. Constraints should be empty.
The removal of the zero on the option is intentional.
-
Seems to be working great at a 60 second repeat time. My LUA code placed directly in to the rules action is running every 60 seconds. I will try a repeat at every 15 minutes next which is what I actually wanted.
Only other thing that might be nice to see, is a count down timer shown on the rules summary card for the repeat time. It does show a count down timer currently for the pulse time only which I have set to 10 seconds.
Many thanks.
-
T toggledbits locked this topic on