Sunrise and sunset triggers are among the most useful smart home automations because they map to how the natural day actually changes. A fixed timer (lights on at 7 PM) is correct for one week of the year. A sunset trigger (lights on at sunset) automatically tracks the changing daylight from 4:30 PM in December to 8:45 PM in June. The same automation works year-round with no adjustment. This guide covers how the triggers work, common use cases, and platform-specific setup.
How sunrise and sunset triggers work
Smart home platforms calculate sunrise and sunset times based on your geographic coordinates and the current date. The calculation uses well-established astronomical formulas. Accuracy is typically within a minute of the actual sunrise or sunset for your exact location.
The calculation requires that the platform know your location. In Apple Home, the location is set in the Home settings. In Google Home, the location is set in the Home or Address settings. In Amazon Alexa, the device location is set per smart speaker. In Home Assistant, the latitude and longitude are configured in the core configuration.
If your platform shows incorrect sunrise/sunset times, the location is usually wrong. Some setups default to a city near the IP address geolocation, which can be off by hundreds of miles. Verify the location is your actual home address before relying on sunset triggers.
Common use cases
The most common use cases for sunset triggers are:
- Porch lights on at sunset. The most universal smart home automation. Configure all exterior lights to turn on at sunset minus 15 to 30 minutes. The slight pre-sunset offset prevents the awkward moment when the porch is dim but not quite dark.
- Indoor lights on at sunset. Living room lamps, kitchen under-cabinet lighting, and accent lights that turn on automatically when the house gets dim.
- Privacy blinds close at sunset. Motorized blinds in street-facing rooms close automatically so people walking by cannot see inside.
- Smart camera mode switch. Some camera systems have day mode (color) and night mode (IR). Most cameras switch automatically based on image sensor light levels, but explicit triggers ensure consistent behavior.
The most common use cases for sunrise triggers are:
- Porch and exterior lights off at sunrise. Reverse of the sunset trigger.
- Blinds open in bedrooms at sunrise plus 15 minutes. Gentle wake-up that mirrors natural daylight.
- Sprinklers start before sunrise. Most efficient irrigation timing is just before sunrise to minimize evaporation. Set the sprinkler trigger to sunrise minus 60 to 90 minutes.
- Pool pump start at sunrise. Daytime filtration cycles often align with sunrise to sunset.
Using offsets effectively
An offset shifts the trigger relative to actual sunrise or sunset. Negative offsets fire before the event. Positive offsets fire after.
Common useful offsets:
- Sunset minus 30 minutes: Exterior lights on before it gets dim
- Sunset plus 15 minutes: Indoor mood lighting on
- Sunset plus 60 minutes: Dim brightly-lit areas to evening levels
- Sunset plus 120 minutes: Reduce living room brightness for movie/wind-down
- Sunrise minus 60 minutes: Sprinklers run during the coolest part of the day
- Sunrise plus 15 minutes: Bedroom blinds open for natural wake-up
- Sunrise plus 30 minutes: Exterior lights off
Avoid offsets larger than 2 hours from sunrise or sunset. At that point, you are essentially using a fixed time of day that happens to shift seasonally. Use a separate time-of-day trigger instead for clarity.
Layering conditions
A pure time-based trigger fires every day. A trigger with conditions only fires when it makes sense. Common conditional layers:
Presence: Only fire if someone is home. A sunset light trigger that fires when the house is empty wastes energy and does not provide the comfort benefit. Most platforms support presence-based conditions using phone location, motion sensors, or explicit home/away modes.
Day of week: Some automations only make sense on weekdays or only on weekends. Morning blind opening might be 7 AM on weekdays but sunrise on weekends.
Weather: A blind that closes at sunset to block hot afternoon sun does not need to close on cloudy days. Some platforms (Home Assistant, smart blind controllers) can incorporate weather data.
Season: Some automations only make sense in certain seasons. Outdoor festive lights might be on at sunset only between Thanksgiving and New Year. Pool circulation might only run during summer months.
Layering conditions makes automations feel intentional. A pure unconditional trigger feels like a timer. A conditional trigger feels like the house responding to context.
Platform-specific setup
Apple Home: Add an automation, choose “A Time of Day Occurs”, select Sunset or Sunrise, add an offset if needed, optionally add a condition (Time, People, Sensor), then add the actions. Apple Home executes the automation on a HomePod or Apple TV hub. Most actions run locally if the devices support HomeKit directly or Matter.
Google Home: Tap “Routines”, then create a new routine. Choose “At sunrise” or “At sunset” with optional offset. Add conditions (Day of Week, Household Member) and actions. Google Home runs many routines through the cloud, so internet connectivity is required for most actions.
Amazon Alexa: Open the Alexa app, tap Routines, create a routine, choose “Sunrise/Sunset” as the trigger, set offset and location. Add conditions and actions. Alexa routines run through the cloud and require internet.
Home Assistant: Add an automation in YAML or through the UI. Use the “Sun” trigger with either “Sunrise” or “Sunset” event, add a time offset if needed, then add conditions and actions. Home Assistant runs all automations locally on your own hardware. No internet required.
SmartThings: Open the SmartThings app, tap “Automations”, choose “Add automation”, set the trigger to “Sun phase” with sunrise/sunset selection and offset. Add conditions and actions. SmartThings runs many automations on the Station hub locally, with some falling back to cloud.
Hubitat: Create a Rule in Rule Machine, add a trigger for “Sunset” or “Sunrise” with offset, add conditions, and define actions. Hubitat runs locally with no cloud dependency.
Common pitfalls
Wrong location. Double-check that your home’s coordinates are set correctly. A default city location produces wrong sunset times.
Daylight saving time confusion. Sunrise/sunset triggers are time-zone aware and adjust automatically across DST transitions. You should not need to do anything when DST changes. If your triggers shift unexpectedly, verify your time zone is correct.
Trigger conflicts. If you have multiple automations on similar triggers (sunset for porch lights, sunset minus 15 for outdoor cameras, sunset plus 30 for indoor lights), they may interact unexpectedly. Document your automation logic and test changes.
Action latency. Wi-Fi lights respond in 1 to 3 seconds. Matter and Thread devices respond in well under a second. Z-Wave responses depend on mesh quality. If timing matters (a sequence of related actions), choose protocols with low latency for the time-critical pieces.
Failed cloud automations. If your automations stop firing intermittently, check whether the trigger or actions are cloud-dependent. Local-first setups (Apple Home over HomeKit, Home Assistant, Hubitat) avoid these failures.
Building your first sunset automation
Start simple. Pick one set of lights you usually turn on at sunset. Create an automation that turns them on at sunset minus 15 minutes and off at midnight. Run it for a week. Adjust the offset based on how the lighting actually feels.
After the first automation works for two weeks, add a second one (turn off at sunrise, for example). Build up gradually. A pile of poorly-tuned automations is worse than a few well-tuned ones.
For more on related smart home decisions see our Matter protocol explained and /methodology.
Frequently asked questions
How do sunrise and sunset triggers know what time to fire?+
Smart home platforms calculate sunrise and sunset using your home's location (latitude and longitude) and the current date. The calculation uses standard astronomical formulas and is accurate to within about a minute. Make sure your home address or location is set correctly in your smart home app. An incorrect location (like a default city) will produce wrong sunrise times.
What is an offset and when should I use one?+
An offset shifts the trigger relative to actual sunrise or sunset. Common offsets include -30 minutes before sunset to turn on porch lights before it gets dark, +30 minutes after sunrise to turn off porch lights once it is fully light, and +60 minutes after sunset to start indoor evening lighting. Offsets compensate for the gap between astronomical sunrise/sunset and perceived daylight, which varies by terrain and weather.
Will sunrise triggers fire during a power outage?+
Triggers do not fire when the smart home hub is offline. When power returns, scheduled triggers that should have fired during the outage typically do not catch up automatically. Some platforms (Home Assistant, Hubitat) have configurable behavior. Most consumer ecosystems (Apple, Google, Alexa) simply skip missed triggers. Important automations should have backup mechanisms or local execution that does not depend on a hub.
Can I combine sunset triggers with other conditions?+
Yes, most platforms support conditional triggers. Common conditions include 'only if I am home' (presence detection), 'only on weekdays' (day-of-week filter), 'only if motion has been detected in the last hour' (presence inference), and 'only if it is cloudy' (weather condition). Combining sunset with conditions makes automations feel intentional rather than always firing on schedule.
Does my smart home need internet for sunrise triggers?+
Most consumer smart home platforms calculate sunrise/sunset locally on the hub or speaker, so they do not require internet for the trigger itself. The trigger may still require internet to control cloud-dependent devices. Local-first platforms (Apple Home with HomePod hub, Home Assistant, Hubitat) work fully offline. Cloud-dependent platforms (some Wi-Fi-only devices, certain Alexa routines) require internet to fire.