A Home Assistant automation blueprint that turns on a light when motion is detected and decides whether to activate based on sunset, a fallback time, weather conditions, and seasonal logic.
This blueprint is intended for motion-activated lighting that should behave differently during the day and at night.
- After sunset, the light can turn on regardless of season or weather.
- After a chosen fallback time, the light can also turn on regardless of season or weather.
- Before sunset and before the fallback time, the light turns on only if the current weather matches the allowed weather list and the current season is allowed.
- The light can optionally turn on at a chosen brightness level.
- The automation can skip turning the light on again if it is already on.
- The light turns off after motion has stayed clear for the configured duration.
- Motion-triggered light activation
- Sunset override
- Late-evening fallback time override
- Weather-based daytime activation
- Seasonal control for pre-sunset weather logic
- Optional brightness percentage
- Skip if the light is already on
- Automatic turn-off after motion clears
| Input | Description |
|---|---|
motion_entity |
Motion sensor that triggers the automation |
light_entity |
Light entity to turn on and off |
weather_entity |
Weather entity, such as weather.openweathermap |
season_entity |
Season sensor, usually sensor.season |
allowed_seasons |
Seasons in which weather-based pre-sunset activation is allowed |
allowed_weather_conditions |
Weather states that allow pre-sunset activation |
force_on_after_time |
Time after which the light can turn on regardless of weather or season |
light_duration |
How long the light remains on after motion goes clear |
skip_if_light_on |
If enabled, does not re-run when the light is already on |
brightness_pct |
Optional brightness percentage; 0 uses the light's default behavior |
This blueprint uses standard Home Assistant weather entity states rather than provider-specific text values. Common states include sunny, partlycloudy, cloudy, rainy, pouring, snowy, snowy-rainy, fog, windy, windy-variant, hail, lightning, lightning-rainy, clear-night, and exceptional. [web:67]
The blueprint allows the light to turn on when any of these conditions is true:
- It is after sunset.
- It is after the configured fallback time.
- It is before sunset and before the fallback time, and both of these are true:
- the current season is in the allowed season list
- the current weather is in the allowed weather list
This approach works well across the year because Home Assistant tracks sunset dynamically, while the fallback time still provides a reliable late-evening activation point during long summer days.
- Copy this blueprint URL:
https://github.com/wgumaa/home-assistant-blueprints/blob/main/motion-light.yaml
- In Home Assistant, go to Settings -> Automations & scenes -> Blueprints.
- Click Import Blueprint.
- Paste the URL above.
- Click Preview and import it.
- Create a new automation from the blueprint.
You can also install the blueprint manually by placing the YAML file in your Home Assistant blueprint folder. A common location is under /config/blueprints/automation/. [web:149][web:161]
- Save the YAML file to:
/config/blueprints/automation/wgumaa/motion-light.yaml
- Reload blueprints or restart Home Assistant if needed.
- Create a new automation from the blueprint.
.
├── README.md
└── motion-light.yaml
This project is licensed under the MIT License.