Home Automation -- Sunset triggers. Who knows what the time is

Have an interesting Home Automation issue, not a major bug but would like to understand the problem. I have two automations that are triggered by sunset – one was created using the Home app on the iPhone and other using the Shortcut app on the iPhone. The Home app is used to turn a bunch of lights on and it seems to run at sunset as reported by the iPhone Weather app. The Shortcut app is used to switch the Apple Watch face and seems to run 2 minutes earlier.

I assume that the Home automations must run on the Apple TV which is the hub. But I would assume that the iPhone Shortcut automations run on the iPhone.

Not a major problem but would be very interested in learning the reason for the difference in time.

There are some interesting factors here, including the actual definition of sunset. It seems to depend on an imaginary observer height and horizon, although the official astronomy definition doesn’t seem to admit this. For example, mountains to the west mean the Sun disappears earlier than a flat horizon. And an elevated observer will observe a later sunset.
Longitude will affect the exact timing of sunset. The rotation of the Earth means that being located about 30km to the West will delay sunset by one minute (on the equator).
So… it depends how the apps are obtaining a value for sunset and it is not surprising that different sources are coming up with different values,

1 Like

including the actual definition of sunset

Having been in Uncle Sam’s Canoe Club where celestial navigation is still somewhat useful…there’s nautical. civil, and astronomical sunset…and they’re all close to the same time but slightly different since they’re defined as the sun (and I can’t remember whether it’s the top, middle or bottom) being below the horizon or a few degrees actually below the horizon…so sunset varies a few minutes depending. I always put it at when you saw the green flash…which happens just before the top dips below the visible horizon…but you need a clear haze free view for it to happen…and I saw it twice our of several hundred times I looked. It only lasts a few seconds and any cloud or haze keeps it from being visible. Pretty cool though.

1 Like

Most sophisticated home automation systems (that is, not HomeKit) allow you to specify an offset before or after Sunrise/Sunset. This allows you to adjust for your local geography and preferences.

Homekit offers that as well (though it’s in blocks of minutes; e.g, 15 minutes, 30 minutes, 45 minutes, 1 hour, 2 hours, 3 hours, 4 hours, all before or after sunrise or sunset.)

1 Like

Hmm, the Home app on my iOS 16.1 device doesn’t seem to offer that, or perhaps its well hidden.

In the Home app, click automation. Add automation, then “a time of day occurs”. Tap sunrise (or sunset). There is a circle-i info control to the right after you tap; tap that and you can set the offset. It’s been in the Home app for a while now, since I started using HomeKit (iOS 13 I think?) or longer.


Thanks - that’s intuitive (not)!