Problems with mutiple scheduled jobs in one rule

Need help with a rule that sometimes doesn't work. When I look in the log for the rule, sometimes an error message pops up, but not every day. I have managed to figure out that it has something to do with scheduled work, but I don't understand why the error occurs. Can someone explain it to me and how I can get rid of the error?

Scheduled jobs 1-19

What version of Rule is this, and what platform version are you on? There was a fix for certain schedules in required expressions a while back that looks a lot like this problem.

Good evening bertabcd1234,
Rule-5.1 and Platform version

Have you tried just hitting "Done" in the rule to see if that helps? Sounds like you're on the latest of everything. (Note that this will also cancel any part of the rule that might already be in progress.)

I always use Done when exit any rule. When this happened the last time, 9 days ago, I tried to reboot the hub and thought that the problem was solved, until today when it occured again.

It's possible the fix necessitated re-creating the rule or at least the required expression part of it, but I don't remember that exactly. One or both of those might be worth trying. (It's also possible you've stumbled upon a remaining bug, but this looks very similar to the one I remember being fixed...)

Also, it's fine to use "Done" to exit a rule, but if you're just opening the rule to look at things, it's not necessary, and it does have the side effect of basically "resetting" things as I mentioned above--just something to keep in mind. :slight_smile: (Consider any effects that cancelling a pending action in your rule may have, should there be one.) You should definitely avoid your browser's back button and other ways from navigating away from the current page in the rule when you're editing, but for viewing, you're safe to leave whenever.

I have now done various tests, where the last one was to write a new rule with the same content as the original one. When I activated the new rule on August 28th, 6 rows of Scheduled jobs were created, see the picture.

Two days later there were still 6 lines when I checked. On the 31st of August there were more rows, on the 1st of September more rows again and today it looks like this.

Could it be that it is a bug or is there something in the rule that causes this, but then the error should appear immediately and not get worse over time. Thanks for any tips I can get

What version do you see if you scroll down in your first screenshot?

Unfortunately I have removed the original rule. The new rule has this version.

That's OK! I was wondering what version you see in the rule that has the problem. Is this still happening with the one you posted above? (Again, a bug that sounds a lot like this one was supposed to have been fixed, but only in 5.1; if not, maybe they missed something...)

Yes, I still have the same problem with the new rule that was created on August 28th.

Probably something for @bravenel to look at, then.

Your rule is triggering multiple times due to the embedded delays in the IF-THEN, and your attempt to prevent that evidently doesn't work. You can easily prove this for yourself by adding a Log action just after the first action. As a consequence of this, it is piling up Scheduled Jobs until it simply breaks from too many (the error message).

I would suggest reworking the logic in your Actions. Simplify. Move the Set PB False to be the very last action of the rule, and get that out of the IF-THEN, and remove the ELSE part of the main IF-THEN (the Exit Rule is entirely superfluous).

Many thanks for your reply bravenel, even if I don't understand exactly what you write :slightly_smiling_face:. I have just rewritten the rule and hope it will work as intended. Will keep an eye on Scheduled jobs in the coming days and hope to report that the problem is resolved in a week or two.

This is how Scheduled jobs looks right now btw.

Unfortunately, it took less than a day before the problem returned.

This is how the rewritten rule looks like:

I don't understand why it triggers multiple times. Shouldn't it be blocked by Required Expression as soon as the rule is run the first time and remain blocked until 21:45 or 23:45 +/- 30 minutes?

This is what Past log looks like:

There is no log entry for this having been triggered, and only a single event from Sensor at the very end. Do you have Triggers enabled in the logs? It's not at all clear what is going on with this. You can also see where you hit Update or Done twice a couple of seconds apart, at the beginning of the logs (bottom), and it looks as though some other rule set the Private Boolean to false.

Please show the Event Subscriptions section of the App Status page (gear icon).

Triggers are enabled in the logs.

Since the PB was in the wrong status (true) which blocked the rule, I changed it to false using another rule I created with a virtual switch vSwitch 4.

Next, I ran the rule manually using Run Actions. The fact that there is only one sensor value is probably due to Required Expression "activating" the 14:00 rule?

Event subscriptions

I really appreciate you taking the time to help me with this. I have a similar rule (3), although a bit simpler, which has never messed up like this. The only differences are that the Required Expression and the Trigger Event look different.

The logs you posted did not show the rule ever being triggered.

That's because I ran the rule manually using the Run Action button. I have now simplified the Trigger Events by removing "stays that way for 0:05:30" to see if that makes the problem go away. If so, I know where the problem lies. The reason I have it is that I don't want the lighting to come on if it's dusk and the sun goes into clouds so the lux value temporarily drops below 60.

Download the Hubitat app