One rule runs, but if I change the delay around - it doesn’t

Here is the same rule with different delays.
Don’t judge me …, the “green” was added for Halloween :sunglasses:
The first rule runs as expected
Lights bright on motion
10 seconds later dim to warm
4 min later green

The second rule ( just the first rule ) with changed times doesn’t run at all.

Why does changing the delay to my desired
Bright on motion, 4 minutes later warm white, 10 seconds later green not work

This is because using the "delay" option on an action schedules that action for that time in the future, then moves on to the next action. What you want is the a "Delay" action itself between these actions, which pauses at that point and then resumes with the next action when the time is up. Alternatively, since these delayed actions are all you have, you could also do some arithmetic to figure out appropriate delay times for your delay options, keeping in mind that they'll all be scheduled nearly simultaneously in this case.

1 Like

The first one runs correctly.
The times work exactly
Lights on Bright
10 sec later warm white
4 min later green

This works as written and expected

The second one does not run - the ONLY difference is the time 4 min vs 10 sec is reversed.
If I put a delay between Bright and Dim - again nothing happens.
Edit: the rule ran for years as written below.
Motion - Lights on Bright
Lights warm white
Delay 4 ( min)
I added the (green) line for this Halloween, adding that line prevents the rule from running UNLESS I change the 4 min to 10 sec and put the 4 min below the green lighting

Right, your second rule will not work because your last action will actually be executed before your second-to-last for the reasons I mentioned above. You also mentioned a different configuration from the one in your original post. This is different from that:

This is how a "standalone" delay action would work, and it's what I suggest using. This is a distinct action you can choose from the menus. It will show on its own line with no "-->" from the previous action (yours actually does show on its own line in your screenshot, but that's just coincidental line wrapping). Your screenshot shows you using the delay option on an action, which works as I described in the other post and won't work as expected here unless you change the timing (e.g., make that last one 4 min and 10 seconds rather than just 10 seconds).

@bertabcd1234 explained it pretty well, but perhaps an example will help. In the example below I am using a simple switch I want to turn it on in 4 minutes and then back off 10 seconds later.

The first example uses the delays as shown in your rule. What actually happens is the switch turns off in 10 seconds and then back on 4 minutes later. Because when the rule is ran it executes each line immediately and sets up a delay so the second line actually executes before the first.
Switch turned off at 12:49:07
Switch turned on at 12:52:57

The second example would do what we want using a explicate delay, it halts execution of the rule until the delay is over. The log below shows both rules running and hopefully that makes it clearer.
Switch turned on at 01:02:27
Switch turned off at 01:02:37 - 10 seconds after turning on


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.