blueprints/automation/motion-light.yaml aktualisiert

This commit is contained in:
2025-08-29 14:49:08 +00:00
parent c14f9b4929
commit 5eeeba2445

View File

@@ -1,17 +1,18 @@
blueprint: blueprint:
name: Smart Motion Light with Optional Lux and Global No-Motion Timer name: Motion-activated Light with Optional Lux
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. description: Turn on a light when motion is detected, optionally only if lux is below a threshold.
domain: automation domain: automation
author: Home Assistant
input: input:
motion_entity: motion_entity:
name: Motion Sensor name: Motion Sensor
selector: selector:
entity: entity:
filter: filter:
- domain: binary_sensor - device_class: occupancy
device_class: motion domain: binary_sensor
- domain: binary_sensor - device_class: motion
device_class: occupancy domain: binary_sensor
light_target: light_target:
name: Light name: Light
selector: selector:
@@ -27,53 +28,57 @@ blueprint:
device_class: illuminance device_class: illuminance
lux_threshold: lux_threshold:
name: Lux Threshold name: Lux Threshold
description: Only turn on the light if lux is below this value.
default: 50 default: 50
selector: selector:
number: number:
min: 0 min: 0
max: 1000 max: 1000
unit_of_measurement: lx unit_of_measurement: lx
no_motion_timer: no_motion_wait:
name: Global No-Motion Timer name: Wait time
description: An input_number entity representing the delay in seconds after motion stops before turning off the light. description: Time to leave the light on after last motion is detected.
default: 120
selector: selector:
entity: number:
domain: input_number min: 0
max: 3600
unit_of_measurement: seconds
mode: restart mode: restart
max_exceeded: silent max_exceeded: silent
trigger: trigger:
- platform: state - platform: state
entity_id: !input.motion_entity entity_id: !input motion_entity
from: "off" from: "off"
to: "on" to: "on"
condition: [] condition:
- alias: "Optional lux check"
action: condition: template
- alias: "Check lux (if defined) before turning on"
choose:
- conditions:
- condition: template
value_template: > value_template: >
{% if lux_entity %} {% if lux_entity %}
{{ states(lux_entity) | float(0) < lux_threshold }} {{ states(lux_entity) | float(0) < lux_threshold }}
{% else %} {% else %}
true true
{% endif %} {% endif %}
sequence:
- service: light.turn_on action:
target: !input.light_target - alias: "Turn on the light"
data: service: light.turn_on
brightness: "{{ brightness }}" target: !input light_target
- alias: "Wait until motion stops"
- alias: "Wait until there is no motion from device"
wait_for_trigger: wait_for_trigger:
- platform: state - platform: state
entity_id: !input.motion_entity entity_id: !input motion_entity
from: "on" from: "on"
to: "off" to: "off"
- delay:
seconds: "{{ states('!input.no_motion_timer') | int }}" - alias: "Wait the number of seconds that has been set"
- service: light.turn_off delay: !input no_motion_wait
target: !input.light_target
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target