Help Sunrise issue (Looks like a BUG?) With screenshots attached

I'll go create a duplicate test test rule now.

Here is the recreaeted

rule. Still evaluating as True for between sunset and sunrise.

Something is messed up with your system time/date/location.

Here is current time and location of hub

Agreed. The midnight job is creating a sunrise event for the previous day. This resurfaced after a restore.

I believe I can fix it buy rescheduling the sunrise job in a rule between midnight and sunrise tonight. Is that the fix? I'm curious how this happened. Any thoughts?

For anyone following this thread or reads it later looking for answers, I have my sunrise issue fixed. Sunrise execution has been correct for 2 days now.

The problem was/is located in something called the beforeSunriseHandler. It appears this piece of code is what executes at midnight and schedules the local sunrise for the hub. My hub knew where it was located because sunset as well as time of day (day of week) rules were executed correctly but, for some reason, the beforeSunriseHandler was scheduling the sunrise job for the day prior to today. Example: today is 5/13/2020, the beforeSunriseHandler was scheduling sunrise for 5/12/2020 so it would never run.

In retrospect, I don't think that it had anything to do with the restore I did a couple days ago. I previously had, and fixed, this same problem and believe that I must have restored to a point before I had fixed the problem.

The actual fix for this is quite easy and involves moving and saving your location a few feet between the hours of midnight and sunrise, thus avoiding the beforeSunriseHandler. After moving your location, open and click done on all of the rules that use sunrise as a trigger so your jobs get rescheduled. I tried just opening the rules and saving them without moving my location but it just rescheduled the job using the beforeSunriseHandler. You have to move your location and save it. Rules that trigger at sunrise-(xx) will show a job immediately. Rules that are triggered at sunrise will not show a job. Rules that are triggered at sunrise+(xx) will have their job scheduled at sunrise. I have also created other test rules and the beforeSunriseHandler & beforeSunsetHandler handler are now scheduling jobs correctly.

I still have no idea what caused the beforeSunriseHandler to enter a flawed state where it didn't know what the correct date was.

UPDATE: another user had an issue where the beforeSunsetHandler was scheduling a job the next day but without a time, thus never executing. They were able to fix their issue and get the job to schedule correctly by following the directions above. It looks like under some unknown condition, the beforeSunriseHandler & the beforeSunsetHandler can get very confused.

3 Likes

Just to give everyone another idea if all else fails,
I used IFTTT to change my mode when it was Sunset because I couldn't get Hubitat to do it correctly.

The hub should be able to do sunrise/sunset. The problem with IFTTT is that it's cloud based. If the web is down, if IFTTT is down, if the HE cloud servers are down it's going to fail. But, if all else fails, this could definitely be your method of last resort.

ā€œShould be ableā€ is the key part there. Iā€™d sunset/sunrise as a trigger stops working at least once between every hubitat software update. Iā€™m hoping using IFTTT will be more stable.

Sunrise and Sunset are 100% reliable for my hubs.

1 Like

After I discovered that moving my location a few feet between midnight and sunrise fixed my sunrise/sunset issues mine has been solid too.

1 Like

That is not an normal occurrence. I can't remember ever having this issue.

Did you report that bug to support@hubitat.com? If many people have this issue, I am sure it would be more likely to be fixed if it has been reported. Support does not and cannot read every post on this forum, so they might be unaware of your troubles.

Edit to say: if you post screenshots of your location screen, like oldcomputerwiz did above, maybe we could see if there is something obviously wrong and try to fix it.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.