Possible Timeout Crossing Midnight Bug

[] I found a light on after midnight a couple of times and actually caught it in the logs once so I created this simple rule to replicate it. You can see from the logs that if the rule is triggered and completed before midnight the rule runs fine. You can also see that if it's triggered after midnight the rule also runs fine. However, when the rule is triggered at 11:58 the 4 minute timeout on the wait fails. The Wait should have ended at 12:02:05. From my simple testing the required expression seems to be needed for the timeout to fail crossing midnight.

1 Like

The wait for expression seems to be the culprit. The way you have it written, the wait expression is going to wait until the light is turned off before proceeding with the 4minute timeout. If the light remains on, the rule should just stop there until you or another rule turns the light off. Then it will wait for more minutes and turn the already off light off again.

No, what you're describing is duration, not timeout. The timeout tell the action how long to wait before canceling that action and moving to the next. You can clearly see that the timeout works as expected when the rule was triggered at 11:40, 11:50, 12:10, and 12:20. It didn't work when triggered at 11:58.

Yep, this is the key observation. I will look into this. The Required Expression causes a method to run shortly after midnight to schedule Sunrise, and it must be that is this method cancelling the pending timeout timer.

I've got a fix for this problem, and it will be in an upcoming release. If you would be so kind as to test again after that comes out, that would be very helpful.


Will do. Thanks, Bruce!

[] My rule has a scheduled job for midnightHandler and the timeout worked.

1 Like