2025-06-18 07:09:10 +00:00
blueprint :
2025-08-29 14:44:36 +00:00
name : Smart Motion Light with Optional Lux Trigger and Time-Based Dimming
description : Turns on a light when motion is detected or when lux drops below a threshold (if sensor is defined), dims based on time, and turns off when no motion.
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-06-18 07:09:10 +00:00
no_motion_wait :
2025-08-29 14:32:25 +00:00
name : Wait Time After Motion Stops
2025-06-18 07:09:10 +00:00
default : 120
selector :
number :
min : 0
max : 3600
unit_of_measurement : seconds
mode : restart
max_exceeded : silent
2025-08-29 14:29:56 +00:00
trigger :
2025-08-29 14:44:36 +00:00
# Motion trigger
2025-08-29 14:29:56 +00:00
- platform : state
entity_id : !input motion_entity
from : "off"
to : "on"
2025-08-29 14:44:36 +00:00
# Optional lux trigger
- platform : template
2025-08-29 14:34:29 +00:00
value_template : >
{% if lux_entity %}
2025-08-29 14:44:36 +00:00
{{ states(lux_entity) | float(0) < lux_threshold and
(states(motion_entity) == 'on' or
(as_timestamp(now()) - as_timestamp(states(motion_entity))) < 300) }}
2025-08-29 14:34:29 +00:00
{% else %}
2025-08-29 14:44:36 +00:00
false
2025-08-29 14:34:29 +00:00
{% endif %}
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 :
- alias : "Turn on the light with calculated brightness"
service : light.turn_on
2025-08-29 14:42:06 +00:00
target : !input.light_target
2025-08-29 14:29:56 +00:00
data :
brightness : "{{ brightness }}"
2025-08-29 14:32:25 +00:00
- alias : "Wait until motion stops"
2025-06-18 07:09:10 +00:00
wait_for_trigger :
2025-08-29 14:29:56 +00:00
- platform : state
2025-08-29 14:42:06 +00:00
entity_id : !input.motion_entity
2025-08-29 14:29:56 +00:00
from : "on"
to : "off"
2025-08-29 14:32:25 +00:00
- alias : "Wait the configured delay"
2025-08-29 14:42:06 +00:00
delay : !input.no_motion_wait
2025-06-18 07:09:10 +00:00
- alias : "Turn off the light"
2025-08-29 14:29:56 +00:00
service : light.turn_off
2025-08-29 14:42:06 +00:00
target : !input.light_target