To get something to notify repeatedly until some conditions are met, try one of these:
If a single condition is going to become true to mean to stop:
Trigger Event: whatever starts the notification
Actions:
IF (NOT condition) REPEAT [notification interval]
Send "notification" TO notification device
END-REP
That is a While Loop. It going to repeat while the Simple Conditional condition is true, and then it will stop once it's false.
Here is a concrete example of that:
Trigger Event: Front Door Opens
Actions:
IF (Front Door Open) Repeat 00:00:30
Notify Bruce "Front Door Open"
END-REP
Each time around this loop it checks the condition of Front Door Open. If it's open, it notifies. If it's closed, the repetition ends and the rule if finished.
If multiple conditions have to be tested to mean to stop:
Trigger Event: whatever starts the notification
Actions:
REPEAT [notification interval] Stop
IF (multiple-conditions) THEN
Stop Repeating Actions
ELSE
Send "notification" TO notification device
END-IF
END-REP
In each of these examples, the notification happens immediately. If you want to wait before notifying, your could put a delay on the Send notification (be sure the delay is less than the notification interval used for the repeat). However, such a delay may mean you get one extra notification. So, another way to do this would be to skip the notification the very first time only. To do that, use a local variable. Here is that with my front door example, using an LV called First Notice.
Trigger Event: Front Door Opens
Actions:
Set First Notice to false
IF (Front Door Open) Repeat 00:00:30
IF (First Notice true) Notify Bruce "Front Door Open"
Set First Notice true
END-REP
Everything works fine except when I turn off the Trash Reminder (VS), repeat doesn't stop
Sorry to be redundant...
Use Case: Trigger:
At a specific day/time each week (I will adjust the trigger once it's working, for now I am using a Virtual Contact Switch)
What I want to happen:
Upon trigger, send notification
Turn on a virtual switch (VS) (Trash Reminder) (can be before send notification as I have no preference)
3: Repeat notification every x mins until the VS is turned off. (which I will do via Echo voice command)
Once VS is closed, turn off repeating notification
If you wanted to use a Wait with a repeat, can you show an example of that for us @bravenel? I am pretty sure that the wait has to go inside the repeat, correct?
There's nothing in your rule to turn it off. It doesn't check your VS. Your rule gets triggered when the VS turns on. But there is no check inside your rule for if the VS gets turned off.
@bravenel, I had posted this in another thread, but it appears this is the more appropriate thread, and possibly you will be able to give me the best advice.
Long story short... there is an app that will automatically change my mode to "Sabbath" when it is appropriate to do so (Sabbath or Holiday based on the Jewish lunar calendar). In addition, at the conclusion of the Sabbath or Holiday, it will change the mode to "After-Sabbath".
My goal is basically, to start running this rule when the mode becomes "Sabbath" and run it every single day until the mode becomes "After-Sabbath". Typically it will either run anywhere from 1-3 times (never 4).
Currently this rule is "paused" since I'm pretty sure it won't work the way I want it to. In addition, I have a rule called "After-sabbath" that when that mode becomes active, it cancels this rule. I feel like that condition (to cancel the repeating event) is probably better to have within the same rule with the repeating event.
Would love to hear your thoughts! Thanks in advance.
So reading this has given me a different perspective than I had when I first saw your Rule. Your app creates two modes "Sabbath" and "After-Sabbath". You should use these (particularly Sabbath) as conditions and not as triggers.
Use Sunset as your trigger.
So your rules would look something like this:
Rule 1
Trigger: When time is Sunset
Actions:
IF (Mode is Sabbath) THEN
Dim: Kitchen Lights: 50
Dim: Living Room etc.
END-IF
Rule 2
Trigger: When time is 6:30AM
Actions:
IF (Mode is Sabbath) THEN
Dim: Living Room etc
Wait for events: When time is 11:00AM
Dim: Kitchen etc.
END-IF
This actually looks great! Thanks for the idea. @bertabcd1234 had a similar idea. I guess when two great minds say one thing its probably the way to go.
Yes, orthodox. Thankfully timers are an accepted work-around to not using electricity on Sabbath/Holidays.
We've come a long way from the timers we used to plug our lamps into with the pins.
One last question to hopefully end my search to perfect these rules. What is the purpose of the "END-IF" statement at the conclusion of your rule? Is that, if the conditions are not met, just end the rule? What happens without the "END-IF"?
Is there a good place to learn about "ELSE-IF" and "ELSE"?
Let's say I make a rule:
Trigger: Sunset
IF (mode is X) then: Turn light on
End-IF
IF (mode is Y) then: Turn light off
END-IF
If (mode is Z) then: Alarm house
END-IF
In this scenario, is END-IF appropriately used, or ELSE-IF should be used? These terms confuse me.
OR should it be:
IF (X) then on
Else-if (y) then off
Else-if (z) then alarm
END-IF
?
Actually, it could be either. The logic works out the same.
When you have a sequence of IFs, as in your first case, if the conditions are mutually exclusive, as in your case, then only one of them can be true. ELSE-IF would work the same way for this case, as if the first one is false, maybe the next one is true, etc.
There can be a difference when the conditions are not mutually exclusive, in which case the order in which the conditions are evaluated is important. In that situation, ELSE-IF comes into its own. In this situation, it would be important only to do the second test if the first test failed. Whereas, with your first case, all 3 tests would happen no matter what.
ELSE-IF would in some cases be more efficient -- in those cases where an early test is likely to be true, thus allowing later tests to be skipped. But, in the case where the last test is true, the two forms have the same efficiency -- finding the truth on the last test performed.
Think of ELSE-IF this way: If the first or prior condition is true, we won't even look at the ELSE-IF or ELSE part. But if the first or prior condition is false, then we will try the ELSE-IF test. If and only if all preceding IF and ELSE-IF are false will we do the ELSE part.
ENDIF just marks then end of the IF-THEN sequence. We need that because IF-THENs can be nested -- the actions to run after the IF-THEN is true might include another IF-THEN. So to keep them all straight we use ENDIF. Sort of like right parenthesis matching a left parenthesis. RM uses textual indentation also to help see the nesting and matching of IF-THEN and ENDIF.
If I use the scenario above with the IF,END-IF 3 times... are you saying that if XYZ are all different variables (day, brightness, temperature) then all three rules would be run if it was Sunday, dark, and over 30 degrees, whereas if ELSE-IF was used only the “X” rule would be run because it was true first, and even though Y and Z were also true they would not be run because X already satisfied the condition.