Refine kontor lighting automation

This commit is contained in:
2026-04-05 17:59:27 +02:00
parent 79eb860711
commit 61aca67c45
2 changed files with 54 additions and 29 deletions
+53 -12
View File
@@ -1,4 +1,5 @@
- alias: Kontor lys motion
- id: kontor_motion_lys
alias: Kontor lys via bevægelse
mode: restart
trigger:
@@ -6,31 +7,71 @@
entity_id: binary_sensor.kontor_motion_bevaegelse
to: "on"
variables:
timeout: >
{% if now().hour >= 6 and now().hour < 22 %}
{{ states('input_number.kontor_timeout_day') | int }}
{% else %}
{{ states('input_number.kontor_timeout_night') | int }}
{% endif %}
condition:
- condition: numeric_state
entity_id: sensor.kontor_belysningsstyrke
below: 60
action:
- service: scene.turn_on
target:
entity_id: scene.kontor_klar
- wait_for_trigger:
- id: kontor_motion_sluk_dag
alias: Sluk kontor lys efter 10 min uden bevægelse
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.kontor_motion_bevaegelse
to: "off"
- delay:
minutes: "{{ timeout }}"
condition:
- condition: time
after: "06:00:00"
before: "23:59:00"
action:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.kontor_motion_bevaegelse
to: "on"
timeout: "00:10:00"
continue_on_timeout: true
- condition: state
entity_id: binary_sensor.kontor_motion_bevaegelse
state: "off"
- service: light.turn_off
target:
entity_id: light.strip
- id: kontor_motion_sluk_nat
alias: Sluk kontor lys efter 5 min uden bevægelse om natten
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.kontor_motion_bevaegelse
to: "off"
condition:
- condition: or
conditions:
- condition: time
before: "06:00:00"
- condition: time
after: "23:59:00"
action:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.kontor_motion_bevaegelse
to: "on"
timeout: "00:05:00"
continue_on_timeout: true
- condition: state
entity_id: binary_sensor.kontor_motion_bevaegelse
state: "off"
- service: light.turn_off
target:
entity_id: light.strip
-16
View File
@@ -1,16 +0,0 @@
kontor_timeout_day:
name: Kontor lys timeout dag
min: 1
max: 60
step: 1
unit_of_measurement: min
initial: 15
kontor_timeout_night:
name: Kontor lys timeout nat
min: 1
max: 30
step: 1
unit_of_measurement: min
initial: 2