When is Sunset/Sunrise Times Updated?

Is there a way to view and/or edit what time the sunrise/sunset values are updated?

I believe they are calculated automatically shortly after midnight, local time. Is there a reason you'd need to do what you're asking? There is likely another way to achieve whatever result.

2 Likes

They're updated a fraction of second after midnight local time, as per hub's set time zone.

2 Likes

I have switches turning on and off throughout the day (many based on sunrise/sunset with offsets)
so just making sure that the time zone doesn't change in the middle of it.

Only you can change your hub's time zone, and there shouldn't be a reason to unless it physically moves (and you want the sunrise/sunset times for the new location and time zone). Is there more to this?

1 Like

By time zone, do you mean shifting from standard time to daylight savings time, and vice-versa. Those will change automatically and at the appropriate time.

Sorry, didn't mean time zone just sunrise/sunset.

Sunrise/sunset with offsets will depend on the app, but most with a negative offset will probably update the schedule shortly after the hub does (just after midnight from the app's own schedule, or...I forget if updated sun times are events apps can subscribe to, but if so, that's also a possibility). [EDIT: Nevermind, I guess this is how most built-in apps used to work but they have made changes; see below. This, more or less, is indeed an option. Custom apps, of course, will still vary.] For actual sunrise/sunset, most apps would probably just subscribe to the event and run a scheduled job at that time. For positive offsets, probably something similar just with a delay. But, again, this depends on how the specific app implements things. With a rule, you have some control and certainly so with a custom app, but if you have any concerns about a particular built-in app or rule, I'd recommend sharing your app configuration.

Or just letting it run, ideally with any logging options the app may have enabled, then see what happens. :slight_smile: Aside from occasional DST quirks, I think most of the time this isn't an issue (and most of these have been addressed too).

1 Like

No, these are set the day before (except for first day). The hub throws an event at sunrise called sunriseTime, which is the sunrise time for the next day. Similar for sunset and sunsetTime. The apps that have before sunrise/sunset offsets subscribe to these events, and schedule the correct time for the next day then. So in the spring in northern hemisphere, there might be two scheduled around the same time for about a minute right before sunrise (or sunset) -- one for today and one for tomorrow. Those are scheduled with the date attached, so it doesn't get confused about which is which.

Way back in the beginning of the company they did it the other way, scheduling a time after midnight to wake up and schedule the time before sunrise or sunset. But that was cumbersome, so we switched to using the events described above instead.

On the first day (i.e., when you hit Done in the app), it looks at the current time and will schedule the first one right then by calculating how far in the future the appropriate time is. So these before offsets are a bit complicated having both first day and subsequent day scheduling to manage.

3 Likes