From 9baac7742f4307ef1aee1170e4981867574d50c8 Mon Sep 17 00:00:00 2001 From: Claus Dethlefsen Date: Sun, 15 Mar 2026 15:35:29 +0100 Subject: [PATCH] lys kontor --- include/automations/lys_kontor.yaml | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 include/automations/lys_kontor.yaml diff --git a/include/automations/lys_kontor.yaml b/include/automations/lys_kontor.yaml new file mode 100644 index 0000000..9e7bd66 --- /dev/null +++ b/include/automations/lys_kontor.yaml @@ -0,0 +1,37 @@ +- alias: Kontor lys motion + mode: restart + + trigger: + - platform: state + 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 %} + + action: + - service: scene.turn_on + target: + entity_id: scene.kontor_klar + + - wait_for_trigger: + - platform: state + entity_id: binary_sensor.kontor_motion_bevaegelse + to: "off" + + - delay: + minutes: "{{ timeout }}" + + - condition: state + entity_id: binary_sensor.kontor_motion_bevaegelse + state: "off" + + - service: light.turn_off + target: + entity_id: light.strip +