Duplicate sunset/rise waits scheduled

I've been running this automation for a few years now but this week it stop working reliably. It is a dusk to dawn automation that turns on/off the porch light.

What I've noticed is the rule does not work when duplicate sunrise/sets are scheduled. I have no clue what is bringing these duplicates. Anyone seen and eliminated these?

Rule and logs below.

That’s an odd one!

I would try clicking on the update button to see if it clears that up.

However, it could also be caused by a corrupted database, so doing a reboot with advanced option: rebuild database selected would be another good thing to try.

Note that those times are all just after midnight. That is when the sunset/sunrise times are recalculated. I imagine it has something to do with your wait for a sunrise offset passing midnight and being recalculated, and rescheduled.

I would remove the wait and just make a separate rule for turning off the light at the sunrise offset.

in the upper right hand corner click :information_source: and scroll down till you see event subscriptions. I would expect to see the rule has 6 subscriptions. If this is true, it would explain the logs.

The only way i know to get an RM rules metadata and data to match is to duplicate the rule and delete the old dup.

IDK why this happends, but so far the pattern is me, editing rules, after my bedtime. Ive not been able to reproduce the issue after i stoped. :thinking:

Thanks for the tip. I can and did split them into two different rules. But what about rules that have delays or waits that can't be split up into before and after midnight parts? These will start to randomly fail and cause many problems - not good.
As mentioned this used to work very reliably for years and only just started failing. Seems like a bug has been introduced in the midnightHandler in the last couple of platform releases. Let's hope someone at Hubitat is watching and can look into this.

I agree, something changed.

If we can trust AI (probably not) this is how it explains what it thinks is happening, and a possible fix. You would need to test this, I don't know how accurate it is, and I am not an RM user.

Strict Midnight Day Boundary Validation

Hubitat implemented tighter validation checks on calendar dates for solar events to prevent phantom execution loops.

  • The Past Logic: If a rule was waiting for sunrise, it simply looked for the next occurrence of that solar event chronologically.
  • The New Logic: When the post-midnight update fires, Rule Machine checks the system event's target date. If the rule engine processes the update before the internal calendar day index completely stabilizes, it may mistake the imminent morning sunrise for a "past event" belonging to yesterday. Consequently, it schedules your wait for the following day's sunrise, adding a massive 24-hour delay

Use "Time Is" Conditions Instead of Time Events

If you want to keep it in a single rule, avoid using Wait for Event -> Sunrise. Instead, trigger your rule at a static time or event, and use a time-conditional check:

  • Change your action to: Wait for Expression -> Time is Sunrise.
  • Why this works: Rule Machine evaluates "Expressions" dynamically against the hub's current status rather than relying on a rigid, single-use cron timer scheduled across midnight

Just came across this post, noted.