Repeat Announcement Until Door Opens

Hi guys,

I am trying to make a repeated trash day reminder announcement, triggered on a certain day at a certain time. I want to stop the repeated announcement once the front door or either garage doors have been opened, making sure the trash was taken out. Below is my attempt, but it looks like it's not continuously monitoring the state of the contacts, like a while loop.

What am I doing wrong?

As an example, I have a Rule that does something like this - nags me until I open the door of the washer or dryer to take out the clothes. Written for me by @ogiewon some many moons ago when he felt sorry for me: :wink:

Your triggers would be:

  • Door opens
  • Certain date/time you want to take out the trash

I actually use Event Engine for trash reminders, has a ton of flexibility and a little easier to create this type of automation...can't do a short/neat screen shot like w/Rule Machine, but this is a summary:

And here are the Event Engine screen shots. If you haven't tried Event Engine yet you should take a look - neat app.

Summary







I was going to tag @bertabcd1234, but looks like he's already replying. :smiley:

1 Like

Maybe post the log, because to me it looks like it should work.

I usually use the Repeat while loop and would be a few less lines in your rule. Your way should work though.

Rule 5.1 does have effectively a "while" loop now, but that's not what a while loop does. It checks the condition at the beginning of the repeat, then proceeds if it's true or skips past the "loop"/repeat if it's false. In order for this condition to be false, the contact sensors would have to be open at the time when the loop starts over again, which could be up to 10 minutes (in your rule) from when it happened.

So, that's the answer to the "why" part of your question. :smiley: But since you want something that works, maybe one of the below suggestions will do what you want. Or, you could use "Wait for event" inside the repeat, maybe something like:

Repeat every 0:10:00 (stoppable)
  Notify "Today is trash day. Pleaes take out the trash."
  Wait for event: Sensor 1, Sensor 2, Sensor 3 opened
  Stop Repeating Actions
END-REP

Here, you'll only reach the "Stop Repeating Actions" if one of the wait events happens. Otherwise, the repeat will just start over again. (I don't love how this piles up the list of things the rule is waiting for, but I don't see a good way to cancel those waits without canceling all timed actions, including the repeat...and this should be pretty harmless if you actually do open one of the sensors and fulfill the event it's waitng for within some reasonable time frame, even hours later. It only creates one subscription but does seem to pile up a list in an internal data structure until it happens, once for each repeat...)

2 Likes

Yep I didn't catch that, I have been using the while loop and didn't think about that. You basically would have to leave the door open in order for that to work.

The wait for event did what I wanted to achieve, thank you!