Auto turn off light

Hi,

I have an Quara FP2, i would like to set it up so if i leave a zone a counter shall start 2min. after 2 min it shall check if zone is empty if it is then turn off light, if not then repeat 2 minute again.

alias: "dining table lights off automation"
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.presence_sensor_fp2_b37d_presence_sensor_5
    from: "on"
    to: "off"
condition:
  - condition: state
    entity_id: input_boolean.notify_gaest
    state: "off"
action:
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
    enabled: true
  - if:
      - condition: state
        entity_id: binary_sensor.presence_sensor_fp2_b37d_presence_sensor_5
        state: "off"
    then:
      - service: light.turn_off
        data: {}
        target:
          area_id: spisestue
    else: []
mode: single

can someone help me finish my code

alias: "dining table lights off automation"
description: ""
trigger:
  - platform: state
    entity_id: binary_sensor.presence_sensor_fp2_b37d_presence_sensor_5
    to: "off"
    for: 
      minutes: 2
condition:
  - condition: state
    entity_id: input_boolean.notify_gaest
    state: "off"
action:
  - service: light.turn_off
    data: {}
    target:
      area_id: spisestue
mode: single

@tom_l thx, that did the trick

1 Like