RM date-driven rules did not change state

I have 2 date-driven rules that did not change state at midnight last night.

First rule is set up to run some RGBW lights between green and red from Dec 1-Dec 30. Second rule is set up to run same RGBW lights in random colors on Dec 31 and Jan 1. Rule 1 should have changed to False at midnight last night, and rule 2 should have changed to True. The time portions of Rule 1 has been working correctly the last week or so, and the time portion of rule 2 just now worked correctly as well, stopping execution before sunrise.

Rule 1 shows False in the UI this morning, but if look through the events tab, it didn't change at midnight. I had to go into the rule and hit Done in order for the actions to stop repeating.

Same with Rule 2: the UI shows it as True, but the events tab shows that nothing happened at midnight. Just like Rule 1, after going into the rule and tapping Done, it actually changed to True and started executing.

I can't see the bottom of your rule so I don't know if you have this for False...do you have it set to stop the actions for this rule? You have to do that or have it stop on truth change, which i can see you don't have enabled. If you don't, it will keep repeating forever.

The rule truth never changed for either rule, that's what I'm pointing out.

**edit - I just checked, and I had the Stop option selected, just wasn't showing in the UI in Rule 1 for whatever reason.

So, you have the repeating canceling in the hidden false part of your rule? I also can't see if you rule logging turned on to log the state of the rule. your screenshot doesn't show everything. You don't show where it logged turning it to false manually when you re-evaluated this morning. Remember, in the webui, the rule state will not necessarily display correctly until you click on it and open it. So, if it said false when you opened it, that meant it was already false when you opened it. You can't say when that happened.

We won't really know for sure I guess. Did you grab the rule settings page before?

The events tab shows when the rule goes true and false. There were no events in either rule at midnight. That's what I'm pointing out.

As I understand it, that will only be logged if you have logging enabled for that rule. I can't see the toggle for your rule in the screenshot, so i didn't want to assume it was on.

This is Rule 2, should have gone True at midnight.

I was talking about your first rule....the Christmas one. I don't see any logs for that at all. Theoretically, if the date didn't work as a condition, the Christmas should have still been true...right?

I have a screenshot in my first post. Same thing, midnight event is missing that should have made the rule go False.

That screenshot doesn't show any events. You know what...never mind.

My point exactly.

Not the ones when you said you clicked on the rule either!!! UGH!!! If you just listened for 2 seconds.....

My wife would say the same thing :rofl::rofl:

Rule 1 events...

Please show the scheduled events for these rules from the app status page.

Scheduled events for Rule 1...there's nothing listed for Sunset tonight, just sunrise tomorrow:

Same for Rule 2:

Looks to me to be a bug in RM wrt looking at the rule at midnight. I'm investigating...

1 Like

Is this right? Sunset is allHandler (had another thread with an error on this), but Sunrise is beforeSunriseHandlier?

Your rule is between sunset and 6 minutes before sunrise, hence the before sunrise handler. If you did 0 minutes before sunset, i wonder if it would use the before sunset handler instead of all. Huh...something to try out.

Yes, this is right. Sunset is a location event, and doesn't need any time calculation. Sunrise-6 is, as Ryan says, a different animal that requires time calculations. Every day at midnight the system throws a pair of events for sunriseTime and sunsetTime. These are used to create these before sunrise events, using math on the time. Were you to create such a condition before sunset (having missed the midnight event), it has to do a different calculation for the first day.

But, back to your reported problem, it is a bug in RM. Actually, the code to schedule checking wasn't implemented. This has been fixed, and will be in the next release. In the meantime, you can work around this bug by creating a Days of the Week condition that you don't use in your rule. That will force the midnight rule evaluation.

2 Likes