blueprints/automation/motion-light.yaml aktualisiert

This commit is contained in:
2025-08-29 14:32:25 +00:00
parent 6f01c59a7b
commit 74d3f5924e

View File

@@ -1,18 +1,17 @@
blueprint:
name: Motion-activated Light
description: Turn on a light when motion is detected, optionally based on lux, and dim based on time of day.
name: Smart Motion Light with Optional Lux and Time-Based Dimming
description: Turns on a light when motion is detected, optionally based on ambient light, and dims based on time of day.
domain: automation
author: mtnet
input:
motion_entity:
name: Motion Sensor
selector:
entity:
filter:
- device_class: occupancy
domain: binary_sensor
- device_class: motion
domain: binary_sensor
- domain: binary_sensor
device_class: motion
- domain: binary_sensor
device_class: occupancy
light_target:
name: Light
selector:
@@ -21,17 +20,14 @@ blueprint:
domain: light
lux_entity:
name: Lux Sensor (optional)
default: ""
default: null
selector:
entity:
domain: sensor
device_class: illuminance
multiple: false
include_entities:
- sensor
lux_threshold:
name: Lux Threshold
description: Minimum lux level below which the light should turn on.
description: Only turn on the light if lux is below this value.
default: 50
selector:
number:
@@ -39,8 +35,7 @@ blueprint:
max: 1000
unit_of_measurement: lx
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
name: Wait Time After Motion Stops
default: 120
selector:
number:
@@ -62,24 +57,37 @@ condition:
condition: or
conditions:
- condition: template
value_template: "{{ !input lux_entity == '' }}"
value_template: "{{ lux_entity is none }}"
- condition: numeric_state
entity_id: !input lux_entity
below: !input lux_threshold
action:
- alias: "Set brightness based on time of day"
variables:
brightness: >
{% set hour = now().hour %}
{% if hour < 6 %}
50
{% elif hour < 12 %}
150
{% elif hour < 18 %}
200
{% else %}
100
{% endif %}
- alias: "Turn on the light with calculated brightness"
service: light.turn_on
target: !input light_target
data:
brightness: "{{ brightness }}"
- alias: "Wait until there is no motion"
- alias: "Wait until motion stops"
wait_for_trigger:
- platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
- alias: "Wait the configured delay"
delay: !input no_motion_wait
- alias: "Turn off the light"
service: light.turn_off