Rules not triggering with Sunrise/Sunset

Your capture of the details of the rule is too small for me to read. Also, you didnā€™t answer my last paragraph of questions. Your rule seems to be setting Day, Night, Evening modes. The ā€œout of the boxā€ Mode Manager has its own idea of when to set those Modes. Did you delete the setting of those modes in Mode Manager (because you seem to be changing the modes yourself)? Just trying to figure out if your rule and Mode Manager are working at cross purposes.

I just posted the logs of sunrise/sunset and the mode changes. You can see that there is no mode changes for Evening yesterday and Day for today. The strange thing is one of the "Day" events happened in the PM?

Have you rebooted during the past 24 hours? The scheduling of Sunrise happens around midnight when the Hub phones home, and I believe it can take up to 24 hours to resynchronize if a reboot or restore causes confusion. In recent threads there is a discussion of that, I believe.

I think thatā€™s why Mode Manager lets you update the mode, for just that situation.

This was a new hub I was deploying to replace a SmartThings deployment. I did most of the configuration here at my home configuring it like it was on premise. Then two Thursday's ago I deployed the hub and re-paired all the ZigBee/Zwave devices which went absolutely flawlessly, even the modes and other automations worked great. Then this week they confirmed that the lighting scenes I setup failed over the last day and remoted into the network to take a look at the logs and found everything I posted here. When I first setup using mode manager it ran for 2 days before it started to malfunction. That Saturday I removed mode manager and put in the rule machine code instead and that ran fine until Thursday this week.

Ok, now I understand. I will look at the rule again with that background.

All offsets with sunrise or sunset minus an amount of time get scheduled at the the previous day's events. So, if you have an event at Sunrise - 30, tomorrow's event gets scheduled at Sunrise today and today's event got scheduled yesterday. So, if you wrote the rule yesterday afternoon, there was no event to schedule.

So, I would wait at least a day and see if it works correctly on day 2.

Oh it's been more than a week. As stated I set this up two Thursdays ago and the put the rule machine version in last Saturday afternoon. Been running find until Thursday this week.

So, the rule worked on Wednesday and not on Thursday? Okay....what did you change/modify/do between Wednesday and Thursday?

Nothing changed. I put the rule in Saturday August 15 between noon and 1:00 pm because Mode manager failed to trigger properly after running for 2 days. It was running fine since the 15th then started to have issues Thursday Into Friday. On the 21st it did not register a Day event at Sunrise +30 but fired of a day event at 8:54 pm.

I didn't mean changes to this rule. I meant what other changes did you make on the hub at all between Wednesday and Thursday? Since it worked and then didn't, something had to change, right?

Also, you can avoid having multiple actions within your action by using a nested If/Then/Else condition instead of simplified conditions. I would have it set up as follows:

If NOT mode away THEN
     If time is between A and B 
          set to Night
    Else if time is between B and C
           set to day
    Else
          set to Evening.
     End-If
End-If

That way you're not playing this -31, -30 game all the time. Makes it a lot easier to set up and avoids having none of the actions fire.

Also, how are you handing coming back from Away mode? You state to not make these changes if you're in away mode, but not how to handle returning. Did you go into away mode at all on Thursday?

No changes to the hub at all. This was a set and forget client hub that I moved off of a SmartThings hub to avoid the use the new app. I have 8 Hubitat installs that I have done at various locations and none of them have had this issue. Even my hub at home uses a like rule for mode changes. This is the first C-7 hub that I have deployed the others are C-4's and C-5's. I would say I am very good with knowing how rules are fired since I have been doing complex automations for home and business automation and orchestration 30 years now. I used to program PLC's at a steel plant :slight_smile:

Iā€™ve gone round and round and get confused. May I suggest a simpler approach? 3 rules.

Rule 1: trigger: when Time is 10:00 pm
Action: Set Mode Night

Rule 2: trigger: Sunrise + 30 minutes
Action: Set Mode Day

Rule 3: trigger: Sunset - 30 minutes
Action: Set Mode Evening

1 Like

I use rules and not mode manager. I think it works more reliably, and I can set modes for different criteria than mode manager allows.

Yep, but is it on the same hardware (C-? vs. C-?) and same firmware version? Right now there are some growing pains with the C-7 and 2.2.3 firmware, which has many changes to support the C-7. With some of the issues, itā€™s hard to tell whether itā€™s the new firmware or what. This may be one of those times, which is why I suggested a very different approach. Your rule might work on your hub at home, just not the new one.

1 Like

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!