2025-06-18 07:09:10 +00:00
blueprint :
2025-08-29 14:46:53 +00:00
name : Smart Motion Light with Optional Lux and Global No-Motion Timer
description : Turns on a light when motion is detected, optionally based on lux sensor, dims based on time of day, and turns off using a global no-motion timer.
2025-06-18 07:09:10 +00:00
domain : automation
input :
motion_entity :
name : Motion Sensor
selector :
entity :
filter :
2025-08-29 14:32:25 +00:00
- domain : binary_sensor
device_class : motion
- domain : binary_sensor
device_class : occupancy
2025-06-18 07:09:10 +00:00
light_target :
name : Light
selector :
target :
entity :
domain : light
2025-08-29 14:29:56 +00:00
lux_entity :
name : Lux Sensor (optional)
2025-08-29 14:32:25 +00:00
default : null
2025-08-29 14:29:56 +00:00
selector :
entity :
domain : sensor
device_class : illuminance
lux_threshold :
name : Lux Threshold
default : 50
selector :
number :
min : 0
max : 1000
unit_of_measurement : lx
2025-08-29 14:46:53 +00:00
no_motion_timer :
name : Global No-Motion Timer
description : An input_number entity representing the delay in seconds after motion stops before turning off the light.
2025-06-18 07:09:10 +00:00
selector :
2025-08-29 14:46:53 +00:00
entity :
domain : input_number
2025-06-18 07:09:10 +00:00
mode : restart
max_exceeded : silent
2025-08-29 14:29:56 +00:00
trigger :
- platform : state
2025-08-29 14:46:53 +00:00
entity_id : !input.motion_entity
2025-08-29 14:29:56 +00:00
from : "off"
to : "on"
2025-06-18 07:09:10 +00:00
2025-08-29 14:44:36 +00:00
condition : [ ]
2025-08-29 14:29:56 +00:00
action :
2025-08-29 14:46:53 +00:00
- alias : "Check lux (if defined) before turning on"
choose :
- conditions :
- condition : template
value_template : >
{% if lux_entity %}
{{ states(lux_entity) | float(0) < lux_threshold }}
{% else %}
true
{% endif %}
sequence :
- service : light.turn_on
target : !input.light_target
data :
brightness : "{{ brightness }}"
- alias : "Wait until motion stops"
wait_for_trigger :
- platform : state
entity_id : !input.motion_entity
from : "on"
to : "off"
- delay :
seconds : "{{ states('!input.no_motion_timer') | int }}"
- service : light.turn_off
target : !input.light_target