RM date-driven rules did not change state

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

Great, thanks Bruce!

Related question for you: Is it better practice to have something with specific dates as a restriction rather than a condition? If a rule is restricted, it won't evaluate at all, correct? Or in the grand scheme of things will it really not matter?

Added day of week, now have midnight scheduled event. Should I see a sunset event here?

**edit - I checked another sunset-to-sunrise rule and it doesn't show sunset or sunrise scheduled events, so this must be ok...

That all depends on whether or not you need to have the rule be evaluated at certain times. For example, if something needs to happen when the date changes, then it would have to be a condition, not a restriction. If you just wanted the rule not to run on certain dates, then a restriction would work.

Okay...makes sense. If a rule is restricted to a specific date range, that restriction comes off at midnight, correct?

yes.

@bravenel this same rule had an event at sunrise-1 this morning but did not change state to false correctly. I had to go in and tap done, then it changed correctly. Any idea what's going on? This is the one I added day of week to in order to force the midnight evaluation.

Here's the full rule:


Scheduled jobs, before tapping done:

Events tab shows that something happened at sunrise-1, but the rule state did not change to False:

After tapping Done, rule state changed:

Scheduled jobs after tapping Done;

Not a clue why it didn't go false.

I didn't get screenshots, but it was doing something else weird before I tapped Done to manually evaluate.

Go into rule, tap the settings cog. Title would show [false] (Repeating)
Tap on Events, then tap App Status to go back to settings page, title would show [true] (Repeating)

I noticed this while getting screenshots. It's not doing it now.

Deleted the rule and recreated. We will see a year from now if it works right :rofl:

Having similar issue...
I have a triggered event based on time of day...
It sends http request to turn a light on and then
a few minutes later sends a brighten command...
was working fine... I had it date restricted November 25 to January 10th...

stopped sending the http command on Jan 1... the other commands to that device that are not date restricted continue to work fine...

A post was split to a new topic: Missed sunset event