Does anyone know if my rule is suppose to look like this (Option A):
Or like this (Option B):
Or it does not matter (Option C).
Does anyone know if my rule is suppose to look like this (Option A):
Or like this (Option B):
Or it does not matter (Option C).
I don't think either will really do what you want. Option A is not correct, as it will just keep repeating the notification every 24 hours. There is no way out of the loop.
I assume you want to repeat the notification until you push the button.
So Option B might work , as I am not sure what will happen on each loop. The wait will not continue until the button is pressed since you have no timeout on the wait. I am not sure if on the next 24 hour loop if it will go again or que up another instance of waiting for a button press.
You could add a timeout of 23 hours and 59 minutes to the wait. Then look at %device% after the rule exits the wait. If %device% is the button, which means it was pressed, then do the stop repeat, otherwise do nothing and the loop will repeat.
There are other ways as well but that is one possibility.
I agree that option A will not work.
Option B will technically work but I believe you will get a new wait ‘waiting’ every 24 hours as already stated.
I have a couple repeat loops in use and I find that it’s very easy to get unwanted behaviour.
I have got in the habit of having one RM simple enable and disable the RM with just the repeat in it.
In the repeat, the first thing I do is check if the enable is true before doing the repeatable action. This is the only 100% method I have found to guarantee that the repeat will not trigger more than I intend.
If the enable is false, then I stop repeating.
I wonder if there might not be a simpler way to do this 24-hour repeat. What’s the rule trigger, and what are you looking to accomplish?
rule trigger is once a year on a certain date at a certain time
What I am trying to accomplish is to get a text reminder to change the safe batteries, I want to keep getting this text message once a day, until such a time as I go into hubitat and press a button.
Use the rule to turn on a virtual switch yearly then you can use a while loop for notifications. The button press can set the virtual switch off (or just turn off the switch) and end the notifications. I'd also suggest using a shorter repeat interval so you can see how it works. Once you understand that, change it to 24 hrs.
Any of the above approaches will work.
This should work and would be a minor update to what you have. waitcomplete is a local string variable. If the wait times out %device will be equal to "timeout", otherwise it will be equal to the button you pushed.
Alright, I did a simple test and created virtually the same rule as "Option A" and "Option B". As confirmed by @terminal3 and @steve.maddigan "Option A" does not work (repeat never stops).
"Option B" works exactly as intended and the push of the button stops the repeat. Thanks everyone for your help. Here is the test rule that worked:
I ran this rule several times, after only 1 message sent (no repetition), after 5 messages sent (4 repetitions), and after 10 messages sent (9 repetitions). The button press always stopped the repeat.
I thought it might work and I just tested it myself, and you are right it does.. The only thing that worried me about that approach was if multiple waits are being queued up. When the 24 hours are up if the button has not been pressed then it is still at the wait. A new rule trigger cancels a wait, but I wasn't sure if a repeat would. It appeared from the log that it did because when the wait is terminated by pushing the button it only had one instance of a stopped loop.
Since it is a 24 hour loop I doubt it would ever be an issue anyway.
This statement articulates the essence of what may be troublesome about "Option B". It works, but I share your concern about every repeat creating a new wait and therefore ending up with multiple waits. Hopefully, there is nothing wrong with this approach and everything will stay stable.
Maybe @bravenel can say for certain.
I use Google calendar for stuff like this. You can set it up to send a text, and/or an email 1 day before, 2 days before, 2 weeks before, 6 months before, etc.
I use Google Calendar as well, but it would not work for me with this particular instance. I know, cause I tried. Easy enough to set-it up like you said, but not so easy to have Google keep giving you reminders until you actually do what you need to do. LOL
I need the repeat, because if HE just sent me one message, I wouldn't do it right away, and forget about it. This way I get the message once a day. It's easy enough to delete the message on my phone, but since I am receiving the message every morning, I will eventually replace the batteries and then cancel the repeat. Can't do this with Google Calendar or at least not as easily as I can do it with Hubitat.
I am getting old. LOL
In one sense they do create a growing queue. But it's irrelevant. Each one is for the same event, so when that event finally happens, it only causes the last wait to be completed.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.