diff --git a/include/automations/lys_stue.yaml b/include/automations/lys_stue.yaml new file mode 100644 index 0000000..475750f --- /dev/null +++ b/include/automations/lys_stue.yaml @@ -0,0 +1,123 @@ +- id: stue_motion_lys + alias: Stue lys via bevægelse + mode: restart + + trigger: + - platform: state + entity_id: binary_sensor.stue_bevaegelse + to: "on" + + condition: + - condition: numeric_state + entity_id: sensor.stue_belysningsstyrke + below: 60 + + action: + - choose: + - conditions: + - condition: time + after: "06:00:00" + before: "16:00:00" + sequence: + - service: scene.turn_on + target: + entity_id: scene.stue_bright + - conditions: + - condition: time + after: "16:00:00" + before: "22:00:00" + sequence: + - service: scene.turn_on + target: + entity_id: scene.stue_annes_favorit + default: + - service: scene.turn_on + target: + entity_id: scene.stue_relax_minus_syd + +- id: stue_motion_sluk_morgen + alias: Sluk stue lys efter 60 min uden bevægelse om morgenen + mode: restart + + trigger: + - platform: state + entity_id: binary_sensor.stue_bevaegelse + to: "off" + + condition: + - condition: time + after: "06:00:00" + before: "16:00:00" + + action: + - wait_for_trigger: + - platform: state + entity_id: binary_sensor.stue_bevaegelse + to: "on" + timeout: "01:00:00" + continue_on_timeout: true + - condition: state + entity_id: binary_sensor.stue_bevaegelse + state: "off" + - service: light.turn_off + target: + entity_id: light.livingroom + +- id: stue_motion_sluk_eftermiddag_aften + alias: Sluk stue lys efter 120 min uden bevægelse mellem 16 og 22 + mode: restart + + trigger: + - platform: state + entity_id: binary_sensor.stue_bevaegelse + to: "off" + + condition: + - condition: time + after: "16:00:00" + before: "22:00:00" + + action: + - wait_for_trigger: + - platform: state + entity_id: binary_sensor.stue_bevaegelse + to: "on" + timeout: "02:00:00" + continue_on_timeout: true + - condition: state + entity_id: binary_sensor.stue_bevaegelse + state: "off" + - service: light.turn_off + target: + entity_id: light.livingroom + +- id: stue_motion_sluk_nat + alias: Sluk stue lys efter 30 min uden bevægelse om natten + mode: restart + + trigger: + - platform: state + entity_id: binary_sensor.stue_bevaegelse + to: "off" + + condition: + - condition: or + conditions: + - condition: time + before: "06:00:00" + - condition: time + after: "22:00:00" + + action: + - wait_for_trigger: + - platform: state + entity_id: binary_sensor.stue_bevaegelse + to: "on" + timeout: "00:30:00" + continue_on_timeout: true + - condition: state + entity_id: binary_sensor.stue_bevaegelse + state: "off" + - service: light.turn_off + target: + entity_id: light.livingroom \ No newline at end of file