Skip to content

Instantly share code, notes, and snippets.

@Rspurdy
Created January 3, 2026 05:19
Show Gist options
  • Select an option

  • Save Rspurdy/dcf72e4b620a3384bdebb4f803853db1 to your computer and use it in GitHub Desktop.

Select an option

Save Rspurdy/dcf72e4b620a3384bdebb4f803853db1 to your computer and use it in GitHub Desktop.
motion_dim_light_time_window.yaml
blueprint:
name: Motion Activated Dim Light (Time Window)
description: >
Turns on a light at a defined brightness when motion is detected,
then turns it off after a configurable delay. Active only within
a defined time window.
domain: automation
input:
motion_sensor:
name: Motion Sensor
description: Motion sensor that triggers the automation
selector:
entity:
domain: binary_sensor
device_class: motion
target_light:
name: Light
description: Light to control
selector:
target:
entity:
domain: light
brightness:
name: Brightness Level
description: Brightness percentage (1–100)
default: 30
selector:
number:
min: 1
max: 100
step: 1
unit_of_measurement: "%"
off_delay:
name: Turn Off Delay (seconds)
description: How long after motion stops before turning the light off
default: 120
selector:
number:
min: 5
max: 3600
step: 5
unit_of_measurement: seconds
start_time:
name: Active From
description: Start time for automation to run
selector:
time:
end_time:
name: Active Until
description: End time for automation to run
selector:
time:
mode: restart
trigger:
- platform: state
entity_id: !input motion_sensor
to: "on"
condition:
- condition: time
after: !input start_time
before: !input end_time
action:
- service: light.turn_on
target: !input target_light
data:
brightness_pct: !input brightness
- wait_for_trigger:
- platform: state
entity_id: !input motion_sensor
to: "off"
- delay:
seconds: !input off_delay
- condition: state
entity_id: !input motion_sensor
state: "off"
- service: light.turn_off
target: !input target_light
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment