blueprints/automation/motion-light.yaml aktualisiert
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
blueprint:
|
||||
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.
|
||||
name: Smart Motion Light with Optional Lux and Time-Based Dimming and Lux Trigger
|
||||
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
|
||||
input:
|
||||
motion_entity:
|
||||
@@ -51,19 +51,23 @@ trigger:
|
||||
entity_id: !input motion_entity
|
||||
from: "off"
|
||||
to: "on"
|
||||
- platform: numeric_state
|
||||
entity_id: !input lux_entity
|
||||
below: !input lux_threshold
|
||||
|
||||
condition:
|
||||
- alias: "Check lux only if sensor is defined"
|
||||
- alias: "Check lux (optional) and recent motion"
|
||||
condition: 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 %}
|
||||
{% set lux_value = states(lux_entity) | float(0) %}
|
||||
{{ lux_value < lux_threshold }}
|
||||
{% set lux_value = states(!input lux_entity) | float(0) %}
|
||||
{{ lux_value < lux_threshold and recent_motion }}
|
||||
{% else %}
|
||||
true
|
||||
{{ recent_motion }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
action:
|
||||
- alias: "Turn on the light with calculated brightness"
|
||||
service: light.turn_on
|
||||
|
||||
Reference in New Issue
Block a user