Will a rule run more than once at a time?

I did not realize that...Thanks!

It is also cancelled by Wait itself. There can only be one pending Wait.

Oh, you're using "WAIT" not delay. I guess there's some difference.

When I use "Delay Actions" it definitely, doesnt cancel the delay after a new rule trigger.

Wait is a very powerful tool for rules. For example, if you want to turn on a light at sunset and turn it off at sunrise, you can do this:

Trigger:  Sunset
Actions:
   On: light
   Wait for certain time: sunrise
   Off: light

In effect, Wait gives you a second trigger for a rule.

I think I correctly re-wrote my above 3.0 rule in 4.0

Now that I know that when a rule is triggered it cancels the wait...

Am I the only one who has to worry about being stupid and leaving the garage door open? :joy:

No, but I for one think of automation like this as something that gets in my way. it would close the door on my wife when she doesn't want it and would make my life harder. so i tend to have to think of all automation in terms of being wife proof.

Am I the only one with a wife and kids that leave them open all the time? :wink:

I'm especially picky about it in the winter.

I was commenting on the lack of Time-of-Day trigger. In your case maybe a trigger on Mode change. Need to catch when it was LEFT OPEN, not just when it's opened and it's already late.

Again..it's about usage. 90% of the time my daytime rules are keeping the door closed. If we are working in the driveway and the pause switch is on...then they don't close. First I have indicator lights (a homeseer switch) that on my way to my bedroom are glaringly obviously red. But lets say I'm already in my bed. When I go into "night" mode, the garage door pause vswitch is turned off and the garage doors are checked for being open. If they are open a similar warning that the garage door was left open and HE is closing it is spoken. Then the rule attempts to close the garage door. Last case is someone left something in front of the optical sensor...then the garage door reports back "stopped"* and another announcement is made that the garage door is stopped. That would be then time to get my butt out of bed and see what's going on.

*before someone asks, yes my garage door controller knows how long it takes to shut the door. And if it doesn't report closed after X seconds of the close command,it knows the garage door didn't close completely. Therefor it is in a "stopped" state.

1 Like

ok, i see how you work now. I'm still newer and do a lot more "control" than "automation".

If you replicate the rule I have above...and add another rule that at 9:30 pm just turns off "garage door pause" it will have your intended action. Aka working in the yard all day (presuming you would have turned on Garage Door Pause so that they wouldn't close after 10 minutes) then at 9:30 it gets turned off and the rule gets triggered. If the door is open it will close after your set number of minutes. You could remove all the "mode" stuff. This would be yours:

and a rule like this:

Now if you ONLY want it to close between two times you could add that like @bravenel showed you in this post:

Or...if I'm gathering correctly what I think you are looking for...that at 9:30 at night if you have not closed your garage door...alert you that it is open and close it for you 10 minutes later if you don't.

In which case....

i will likely take a bit of each of these examples.

I will spend hours and possibly money...
...and it will work EXACTLY as I want
...and I will be happy

...and the wife and daughter will shrug their shoulders and say "I guess that's cool and all"

1 Like

Last time I moved I told my wife I wasn't going to install a home automation system, I didn't want to maintain it. (I still don't but I am, just much less now). She said she had to have the "Night Night button" the one that turns off all the lights in the house and adjust the thermostats and checks the lock. ....So I have a home automation system... :roll_eyes:

1 Like

Curious. Is it different/better to "wait" for sunrise than to just have a second rule triggered at sunrise? Is there some advantage to this? Thx

About the "cancelled by Wait itself. There can only be one pending Wait".

So. Is that "one wait per rule" or "one wait per entire HE system"?

I'm actually doing several similar things plus pretty much about the same sort of thing as the person writing this post--involving shutting the garage door after dark after a few moments when nothing intervenes (e.g., start the timer again when motion in the garage).

I also have a number of rules that do thing like "lock all the doors, turn out the lights, etc." with delays, etc.

They are often triggered by things like arming the system, locking doors, etc.

BUT.... If I turn right around and UNlock the doors, DISarm the system, etc. before all the delayed events happen, then RElock the doors and REarm the system. Well, I'm concerned about how to sort that all out. I'm leaning towards doing "cancel delayed actions" on those other rules.

Because. It's not uncommon for me to lock up the house--then remember something I left inside--unlock and open it up--grab my stuff--then lock it all back up. All in a few seconds. Which could leave a lot of "dangling rules" to create issues.

If I started a rule off by doing a "Cancel Delayed Actions"--and use the "Delayed xxx" on each delayed command (rather than "in line" delays)--would that keep the rules from stomping on themselves?

It does seem that something like:

Turn on A
Delay 10 seconds
Turn on B
Delay 10 seconds
Turn on C

Could work about the same as:
Turn on A
Turn on B Delay 10 seconds
Turn on C Delay 20 seconds

Right?

The main difference is one rule vs two. There is also the subtle significance of a trigger event cancelling a pending Wait.

One pending Wait per rule.

Yes, those are equivalent.

1 Like

About all the rule issues and recursive behavior.

Let's say I do a "Run Actions" on "Rule ABC" from inside "Rule XYZ".

"Rule XYZ" is the "parent" and "Rule ABC" is the "child" (subroutine).

Does "Rule XYZ" remain active while Rule ABC runs (with delays, etc.)?

Does cancelling timed actions on "Rule XYZ" stop the actions in "Rule ABC"?

Conversely, does cancelling the timed actions for "Rule ABC" kill those actions when run from "Rule XYZ"?

The name of the rule action makes it sound like the actions are sucked up and run from within and as part of "Rule XYZ"--but I figure that may not be actually true. :slight_smile:

Thanks.

Run Actions of another rule simply launches the actions of that rule. The XYZ rule keeps on going -- it is not a "subroutine" call, with XYZ waiting for ABC to complete. The two are independent. The delays in one rule have nothing at all to do with the delays in another rule. The hub has multi-threaded execution. There is no guarantee as to the relative timing of the actions in ABC and XYZ, other than the fact that ABC is launched by XYZ.

A rule's actions can be launched by a trigger. They can be launched by another rule. In each case they do pretty much the same thing (but for things like %device% or %value% in messages).

If you wanted the effect of a subroutine, that could be done by using a global variable. If XYZ wants ABC to complete before "continuing". It could set the variable to false, run the actions of ABC, then Wait for ABC to set the variable to true. That would best be done with a Wait for Condition, in case ABC finishes before XYZ takes another step after launching ABC. ABC's last action would be to set the variable to true. This could be extended into a "function" call, where a value is returned by ABC -- again using a global variable to 'return' the value.