From 79eb86071122d5bcd23c956f65bd21b1c4fb0fca Mon Sep 17 00:00:00 2001 From: Claus Dethlefsen Date: Sun, 5 Apr 2026 17:41:10 +0200 Subject: [PATCH] Add forgang motion lighting automation --- include/automations/lys_forgang.yaml | 87 ++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/include/automations/lys_forgang.yaml b/include/automations/lys_forgang.yaml index e69de29..9c8f595 100644 --- a/include/automations/lys_forgang.yaml +++ b/include/automations/lys_forgang.yaml @@ -0,0 +1,87 @@ +- id: forgang_motion_lys + alias: Forgang lys via bevægelse + mode: restart + + trigger: + - platform: state + entity_id: binary_sensor.forgang_bevaegelse + to: "on" + + condition: + - condition: numeric_state + entity_id: sensor.forgang_sensor_illuminance + below: 60 + + action: + - choose: + - conditions: + - condition: time + after: "06:00:00" + before: "23:59:00" + sequence: + - service: scene.turn_on + target: + entity_id: scene.forgang_bright + default: + - service: scene.turn_on + target: + entity_id: scene.forgang_dimmed + +- id: forgang_motion_sluk_dag + alias: Sluk forgang lys efter 10 min uden bevægelse + mode: restart + + trigger: + - platform: state + entity_id: binary_sensor.forgang_bevaegelse + to: "off" + + condition: + - condition: time + after: "06:00:00" + before: "23:59:00" + + action: + - wait_for_trigger: + - platform: state + entity_id: binary_sensor.forgang_bevaegelse + to: "on" + timeout: "00:10:00" + continue_on_timeout: true + - condition: state + entity_id: binary_sensor.forgang_bevaegelse + state: "off" + - service: light.turn_off + target: + entity_id: light.forgang + +- id: forgang_motion_sluk_nat + alias: Sluk forgang lys efter 5 min uden bevægelse om natten + mode: restart + + trigger: + - platform: state + entity_id: binary_sensor.forgang_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.forgang_bevaegelse + to: "on" + timeout: "00:05:00" + continue_on_timeout: true + - condition: state + entity_id: binary_sensor.forgang_bevaegelse + state: "off" + - service: light.turn_off + target: + entity_id: light.forgang