Skip to content

wgumaa/Motion-Light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Motion Light (Weather + Sunset + Time + Seasonal Weather Logic)

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.

Overview

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.

Features

  • 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

Inputs

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

Weather states

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]

Logic

The blueprint allows the light to turn on when any of these conditions is true:

  1. It is after sunset.
  2. It is after the configured fallback time.
  3. 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.

Installation

Open your Home Assistant instance and import this blueprint

Import from a URL

  1. Copy this blueprint URL:
https://github.com/wgumaa/home-assistant-blueprints/blob/main/motion-light.yaml
  1. In Home Assistant, go to Settings -> Automations & scenes -> Blueprints.
  2. Click Import Blueprint.
  3. Paste the URL above.
  4. Click Preview and import it.
  5. Create a new automation from the blueprint.

Manual installation

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]

  1. Save the YAML file to:
/config/blueprints/automation/wgumaa/motion-light.yaml
  1. Reload blueprints or restart Home Assistant if needed.
  2. Create a new automation from the blueprint.

Repository contents

.
├── README.md
└── motion-light.yaml

License

This project is licensed under the MIT License.

About

Motion-activated light blueprint with weather, sunset, season, and late-time override logic.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors