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: blueprint:
name: Motion-activated Light name: Smart Motion Light with Optional Lux and Time-Based Dimming
description: Turn on a light when motion is detected, optionally based on lux, and dim based on time of day. description: Turns on a light when motion is detected, optionally based on ambient light, and dims based on time of day.
domain: automation domain: automation
author: mtnet
input: input:
motion_entity: motion_entity:
name: Motion Sensor name: Motion Sensor
selector: selector:
entity: entity:
filter: filter:
- device_class: occupancy - domain: binary_sensor
domain: binary_sensor device_class: motion
- device_class: motion - domain: binary_sensor
domain: binary_sensor device_class: occupancy
light_target: light_target:
name: Light name: Light
selector: selector:
@@ -21,17 +20,14 @@ blueprint:
domain: light domain: light
lux_entity: lux_entity:
name: Lux Sensor (optional) name: Lux Sensor (optional)
default: "" default: null
selector: selector:
entity: entity:
domain: sensor domain: sensor
device_class: illuminance device_class: illuminance
multiple: false
include_entities:
- sensor
lux_threshold: lux_threshold:
name: 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 default: 50
selector: selector:
number: number:
@@ -39,8 +35,7 @@ blueprint:
max: 1000 max: 1000
unit_of_measurement: lx unit_of_measurement: lx
no_motion_wait: no_motion_wait:
name: Wait time name: Wait Time After Motion Stops
description: Time to leave the light on after last motion is detected.
default: 120 default: 120
selector: selector:
number: number:
@@ -62,24 +57,37 @@ condition:
condition: or condition: or
conditions: conditions:
- condition: template - condition: template
value_template: "{{ !input lux_entity == '' }}" value_template: "{{ lux_entity is none }}"
- condition: numeric_state - condition: numeric_state
entity_id: !input lux_entity entity_id: !input lux_entity
below: !input lux_threshold below: !input lux_threshold
action: 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" - alias: "Turn on the light with calculated brightness"
service: light.turn_on service: light.turn_on
target: !input light_target target: !input light_target
data: data:
brightness: "{{ brightness }}" brightness: "{{ brightness }}"
- alias: "Wait until there is no motion" - alias: "Wait until motion stops"
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"
- alias: "Wait the number of seconds that has been set" - alias: "Wait the configured delay"
delay: !input no_motion_wait delay: !input no_motion_wait
- alias: "Turn off the light" - alias: "Turn off the light"
service: light.turn_off service: light.turn_off