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

@bravenel

Good morning Bruce.. Sunrise is still broken for me. I noticed something that you might be able to shed some light on. I took this screenshot at 11:25pm yesterday and it shows the midnight job to run on 5/12 @ 12:00 midnight, all good.

Here is the screenshot I took after midnight. I didn't catch this last night but I see it this morning. The sunrise job has been scheduled for 5/11, yesterday. It will never run.

Here is a screenshot of my hub time and it looks correct.

What do you need from me to resolve this? I think I can fix it by moving my location around between midnight and sunrise and bypass the "midnight job" as I was able to generate the sunrise event yesterday when I did this by "moving the hub to Hawaii" but don't want to do that tonight (tomorrow morning) if you want to try and track down why this is happening. I have all the screenshots from before and after the "midnight job" run if you want them.

EDIT: All the rules that use sunset to sunrise restriction are not currently honoring the restriction, as has been the case each morning. Rather than hit "update" in location and mode to fix this for the day I'm leaving it until I hear from you.

Let me know what you would like me to do. Thanks

Please show one of these rules, the main setup page of it.

. I just grabbed this moments ago.

There aren't any "restrictions" in that rule. Have you turned on Action logging, to see what is actually happening?

"Restrictions" don't exist in Rule Machine (they used to). They do exist in Simple Automation Rules.

Ok. Not a restriction as in SA. It's a condition. The sunset to sunrise condition is evaluating as True (unless I'm reading it wrong) and the current time is almost 11am. Well past sunrise.

I have not turned on logging for this rule as I am certain it's related to the fact I'm not getting a sunrise event.

If there is a different kind of log your looking for you will have to tell me exactly what it is. I'm not completely familiar with everything in HE yet.

OK, I see that now. I don't know what is going on with this rule.

Please recreate this rule from scratch, and see what it shows for the truth of that condition.

I can do that but why is the midnight job creating a sunrise event for the previous day? I am not getting a sunrise event in my system events. If I go and press update in location and modes sunset to sunrise will evaluate as false.

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.