How I Use Repeat

IF (Start Routine(off) is on(F) [FALSE]) THEN
Repeat every 0:02:30 (stoppable)
voiceCmdAsText('Co2 On') on Echo - Game Room
voiceCmdAsText('Co2 Off') on Echo - Game Room --> delayed: 0:00:20
END-REP
END-IF

Is there a question, or are you just sharing an example? If the latter, this would be better with the entire rule shown, including triggers. Either way, nothing looks like it's going to stop this repeat you have written (even though it's marked "stoppable," unless you have another rule doing so, and in that case you don't need to use this flag).

I do have a virtual switch to turn it off and on (the routine). I was putting it up there so I could get feedback on how to use it. Thanks. This is the first time using this function and I could not find too much on how to implement it. I will be better at stating my intentions of the post better next time. First time participating in that also (smile).

In that case, welcome to the Community! :smiley:

One way you can make that repeat stop when the switch is turned off (nothing does that right now) is to use a "Repeat While (Expression)" instead of your current repeat (this would replace your existing "Repeat every..." and also the IF THEN/END-IF). The expression would be the switch being on.

In older rule examples -- perhaps what inspired yours -- you may see something similar to what you have, just using a "simple conditional" (IF only, no IF THEN/END-IF, and on the same "line" as the repeat--indicating the simple condintional applies only to that line, part of what makes it simple). That still would work and is logically equivant to "repeat while," but the existence of this separate action makes it clearer IMHO.

The Rule 5.1 documentation has examples of various repeats if you have not seen it yet:

Good luck!

Thanks !! This is going to be fun !!

Thanks for the info. After using your suggestion and referring to the 5.1 rule docs. I have rewritten it this way.
While (Start Routine(on) is on(T) [TRUE]) Repeat every 0:01:30
voiceCmdAsText('Co2 On') on Echo - Game Room
voiceCmdAsText('Co2 Off') on Echo - Game Room --> delayed: 0:00:20
END-REP

3 Likes