blueprints/automation/motion-light.yaml aktualisiert
This commit is contained in:
@@ -54,28 +54,15 @@ trigger:
|
||||
|
||||
condition:
|
||||
- alias: "Check lux only if sensor is defined"
|
||||
condition: or
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: "{{ lux_entity is none }}"
|
||||
- condition: numeric_state
|
||||
entity_id: !input lux_entity
|
||||
below: !input lux_threshold
|
||||
condition: template
|
||||
value_template: >
|
||||
{% if lux_entity %}
|
||||
{{ states(lux_entity) | float < lux_threshold }}
|
||||
{% else %}
|
||||
true
|
||||
{% endif %}
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user