Rules not triggering with Sunrise/Sunset

I think I found the issue over the weekend on this. I use the NTP device from @dan.t

And there was a version update that I never applied to my test device here at home which changed some of the parameters for how often the query to the time server was done and the drift before updating time. I my test device at home has a 1 minute drift and the one that I deployed had a 1 second interval.

Seeing that I decided to change the drift to a 1 minute interval and see what happens and so far Saturday night, Sunday, and now the A.M Monday everything from my original rule is firing just fine. It may be a coincidence but I going to let these setting sit for the week and see what happens. The NTP server that is running at that location is built into the Asus router and has been reliable for a couple of years now. Keeping fingers crossed.

1 Like

The NTP Client app fixed it for me a few months ago.

Looks like they uncovered some Sunrise/Sunset issues and updated in 2.2.3.132:

Added new calculated times for apps.

  • todaysSunrise
  • todaysSunset
  • tomorrowsSunrise
  • tomorrowsSunset
1 Like

I'm running into the exact same issue here, in that Time Between Sunrise and Sunset isn't resolving the way I expect it to. Are these calculated values that YOU created, or...?

Nope I am just using the internal time components in rule machine for sunrise/set. Since I updated and let the hub settle down for a day after I reported this issue the sunrise/sunset calculations have been working fine.

When you've got a moment, would you be willing to post a screenshot of how you reference these? The only reference I can find to those items all bring me back to your post here. I'm just seeing "Sunrise/Sunset" as my RM time options, unless I need to do something different.

Thanks!

The internal variables that I posted previously aren't directly exposed in rule machine but used when the condition's are evaluated from what I understand. Here is my rules. For the trigger events I used just sunrise/sunset with offsets.

That makes sense. For whatever reason, my HE seems to be updating the sunrise/sunset times immediately when the sunrise/sunset event occurs, then always referencing the new times in the rules.

My workaround was to create two new global variables in RM: todaysSunrise & todaysSunset. I have a rule that updates them each day, then use them in my rules. Works so far.

Have you looked at Mode Manager?

Yes but back last year with the C7 there were all sorts of time/sunrise/sunset issues that were finally resolved. I just never moved back to Mode manager because that Rule Machine rule was working. If it works why change :slight_smile:

2 Likes

Oddly I have only had a C7 and never had issues with Mode Manager but it's one of the great things with Hubitat is to have options.

Yes. But I can't get the "Earlier of two times/later of two times" time rules to work, The rule I finally implemented was:

IF (Time between 21:00 and 23:59) THEN
    Mode: Night
ELSE-IF (Time between 18:00 and 21:00 OR Time between sunsetToday and 21:00) THEN
    Mode: Evening
ELSE-IF (Time between 07:00 and 18:00 AND Time between sunriseToday and 18:00) THEN
    Mode: Day
ELSE-IF (Time between 05:00 and 07:00) THEN
    Mode: Early Morning
ELSE
    Mode: Late Night
END-IF