Possible Bug [] - Timeout in Wait for Expression being handled as an additional wait

@bravenel - I think this may be a bug.

I have this master rule to trigger some other rules to close curtains shown below. It triggers at 16:45. The first action is to wait until the time is between sunset +15 and 22:00 (the timeout on the wait is that so that in summer, the actions will occur no later than 21:30 regardless of sunset time). The proceeding actions are to run the actions of other rules:

This has been running fine for months so I don't understand why it didn't complete today. The logs below show the time being scheduled for 16:45, the rule triggering, the expression becoming true but non of the actions occurred:

It seems as though the timeout in the wait for expression is not working as it should. I'd expect it to wait until the expression is true and if it doesn't become true within 4:45 minutes - carry out the actions anyway. What's happening is that it's always worked up to and including Thursday when the expression was already true at the time of trigger (16:45). Since Thursday when sunset has been later, the timeout is being added as an additional wait. I can see this in the logs as the actions are occurring after 4 hours 45.

In essence it's doing:

  • Wait for expression - time between sunset+15 and 22:00 (timeout 4:45)
  • Expression now true
  • Wait 4:45
  • Do actions

Here is the evidence. It works on the 25th when the expression is already true ('not waiting') but on the 26th when it needed to wait 1 minute for the expression to be true, it incorrectly adds the 4:45 timeout as another wait ('Expression now true: Between two times is true, waiting for duration 4:45:00):

Hmmm, I'll look into it. It appears to be treating the Timeout as a Duration.

@bravenel Just edited original post to show that. Thankfully have the logs for last two days.

Let me know if you want me to check anything now as in the uk I'm currently within that incorrect 4:45 wait...

There appear to be two things going on: First, the logging is very wonky for this case, using the word "duration" when it's a timeout, and second, but more importantly, if the expression becomes true it is still waiting for the timeout before continuing, when it should continue right then.

And that appears to be caused by the wrong handler being scheduled for the Between two times condition.


Thanks Bruce. For now I can simply temporarily remove the timeout on the 'wait until expression'. That's not needed until summer - it's 6 degrees celsius (42f) and summer seems a long time away...

I found the bug, and the fix will be in the next release.


You can remove the timeout by adding 21:30 as an OR condition to your Wait

Wait for Expression: Time between Sunset+15 minutes and 22:00 OR Time between 21:30 and 21:30

1 Like

Is it also going to fix what I have happening here? Rule Machine - rule stops after wait for event with timeout

Great - thanks Bruce :+1:

1 Like