blueprints/automation/motion-light.yaml aktualisiert
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
blueprint:
|
blueprint:
|
||||||
name: Smart Motion Light with Optional Lux and Time-Based Dimming and Lux Trigger
|
name: Smart Motion Light with Optional Lux and Time-Based Dimming
|
||||||
description: Turns on a light when motion is detected or when lux falls below a threshold, optionally based on ambient light, and dims based on time of day. Turns off when no motion is detected.
|
description: Turns on a light when motion is detected or when lux falls below a threshold (optional), and dims based on time of day. Turns off when no motion is detected.
|
||||||
domain: automation
|
domain: automation
|
||||||
input:
|
input:
|
||||||
motion_entity:
|
motion_entity:
|
||||||
@@ -27,7 +27,7 @@ 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.
|
description: Only turn on the light if lux is below this value (if sensor is defined).
|
||||||
default: 50
|
default: 50
|
||||||
selector:
|
selector:
|
||||||
number:
|
number:
|
||||||
@@ -56,14 +56,14 @@ trigger:
|
|||||||
below: !input lux_threshold
|
below: !input lux_threshold
|
||||||
|
|
||||||
condition:
|
condition:
|
||||||
- alias: "Check lux (optional) and recent motion"
|
- alias: "Optional lux check and recent motion"
|
||||||
condition: template
|
condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
{% set last_motion = states(!input motion_entity) %}
|
{% set last_motion = states(!input.motion_entity) %}
|
||||||
{% set recent_motion = (last_motion == 'on') or (as_timestamp(now()) - as_timestamp(last_motion)) < 300 %}
|
{% set recent_motion = (last_motion == 'on') or (as_timestamp(now()) - as_timestamp(last_motion)) < 300 %}
|
||||||
{% if lux_entity %}
|
{% if lux_entity %}
|
||||||
{% set lux_value = states(!input lux_entity) | float(0) %}
|
{% set lux_value = states(lux_entity) | float(0) %}
|
||||||
{{ lux_value < lux_threshold and recent_motion }}
|
{{ recent_motion and lux_value < lux_threshold }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ recent_motion }}
|
{{ recent_motion }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -71,17 +71,17 @@ condition:
|
|||||||
action:
|
action:
|
||||||
- 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 motion stops"
|
- 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 configured delay"
|
- 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
|
||||||
target: !input light_target
|
target: !input.light_target
|
||||||
|
|||||||
Reference in New Issue
Block a user