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
|
name: Smart Motion Light with Optional Lux and Time-Based Dimming and Lux Trigger
|
||||||
description: Turns on a light when motion is detected, optionally based on ambient light, and dims based on time of day.
|
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.
|
||||||
domain: automation
|
domain: automation
|
||||||
input:
|
input:
|
||||||
motion_entity:
|
motion_entity:
|
||||||
@@ -51,19 +51,23 @@ trigger:
|
|||||||
entity_id: !input motion_entity
|
entity_id: !input motion_entity
|
||||||
from: "off"
|
from: "off"
|
||||||
to: "on"
|
to: "on"
|
||||||
|
- platform: numeric_state
|
||||||
|
entity_id: !input lux_entity
|
||||||
|
below: !input lux_threshold
|
||||||
|
|
||||||
condition:
|
condition:
|
||||||
- alias: "Check lux only if sensor is defined"
|
- alias: "Check lux (optional) and recent motion"
|
||||||
condition: template
|
condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
|
{% set last_motion = states(!input motion_entity) %}
|
||||||
|
{% 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(lux_entity) | float(0) %}
|
{% set lux_value = states(!input lux_entity) | float(0) %}
|
||||||
{{ lux_value < lux_threshold }}
|
{{ lux_value < lux_threshold and recent_motion }}
|
||||||
{% else %}
|
{% else %}
|
||||||
true
|
{{ recent_motion }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user