Sunset, sunrise triggers at the wrong time since blackout

Yesterday we had a power outage for half a day until about 2:30pm. Last night, long after everything was up and running again, the automation that is supposed to turn on some lights at sunset did not trigger, instead it triggered about 6 hours too late. Same for the sunrise trigger. Time based triggers work correctly. The map coordinates are correct. It is as if HA thinks it lives in a different location.


Sunset is supposed to be about 6pm (18:00) not close to midnight.
(The “5 hours ago” and time is correct in this screenshot, I am an early riser :slightly_smiling_face:)

I just did a system reboot, then I wrote an automation to test the sunrise (using offset), and it worked as expected. Hm… I should have done the test before the restart. Anyway, I will report back tonight when the existing automation is supposed to be triggered.

Hi, do you use a RPi and/or did you check the time of your system?

I am using a Raspberry Pi Green, apparently without RTC, but the time is correct. It appears that existing time based automations are all late by just under 6 hours, only newly written automations work correctly. I just realised the blackout was for about the same length of time, just under 6 hours. Interesting!

In the meantime, the clock might have been synchronized but did you check it before?
Be aware that this could be an issue after a power failure.

Checking the clock was one of the first things I did and it has always been correct, since power came back.

Thanks for getting involved Nick.
Here is just a quick update. Meanwhile the issue is resolved. However something was definitely going on. Here is a quick summary.

  • Sunday 2:30PM power came back after 6 hours of blackout. Half an hour later internet was connected again
  • Sunday, sunset approx 6PM automation did not fire and lights stayed off.
  • Sunday around Midnight (6 hours too late), lights came on unexpectedly
  • Monday 7AM an automation that was scheduled for 1AM got triggered.
  • all of the reports and reported time were always correct
    **Next steps, chronologically listed **
  • I created a time-based test automation which was successful
  • I initiated a system reboot
  • I created further Sun based test automations which were all successful
  • at sunset, the lights turned on and scheduled automation triggered correctly at 1AM

I don’t know if the reboot fixed it or not, but for quite some time (18h+), time based automations were lagging by approximately the same amount of time as the blackout was long.

Good you got it solved!

I wonder if the clock from the RPi might have been synced at a certain point when your WAN connection came back online but HA needed that restart to correct it’s time settings…

Please mark the post that helped you solving your issue as the solution so anyone who’s searching for this can benefit from it like you did.
You do that by selecting the three dots under the post:

image

Then select the check box:

image

Also, by doing so this prevents that someone else steps in to try to help.