Using a timer to setup a scene condition - Help needed

I am trying to setup a scene where in an entity would get switched on (Action) if I am Away (nmap). Is there a way to set it up where I can set the Condition to be valid if I am Away for 1-15 minutes; and after the 16th minute the Condition would be invalid and therefore the Action would not get triggered?

my current scene configuration in YAML.

Below only has the condition FOR 1 Minute. I want to replace it with FOR 1 Minute and LESS THAN 15 Minutes

description: “”
mode: single
triggers:

  • entity_id:
    • binary_sensor.bedroom_sensor_motion
    • binary_sensor.bedroom_motion_centre_motion
    • binary_sensor.bathroom_motion
    • binary_sensor.living_room_sensor_motion
    • binary_sensor.guest_bathroom_motion
    • binary_sensor.entry_and_kitchen_motion_sensor_motion
      from: null
      to: “on”
      trigger: state
      conditions:
  • condition: state
    entity_id: person.me
    state: not_home
    for:
    hours: 0
    minutes: 1
    seconds: 0
    actions:
  • action: switch.turn_on
    metadata: {}
    data: {}
    target:
    entity_id: switch.wifi_socket_2_socket_3

Add a NOT condition to your automation (you referred to it as a “scene” but it’s an automation; scenes and automations are two different concepts).

conditions:
  - condition: state
    entity_id: person.me
    state: not_home
    for:
      minutes: 1
  - condition: not
    conditions:
      - condition: state
        entity_id: person.me
        state: not_home
        for:
          minutes: 15

The two conditions require that person.me is not_home for at least 1 minute but not for longer than 15 minutes.

1 Like

@123 I guess it’s working. Will test it again. Thank you so much, turns out it was something simple I missed.

I use an UNUSED switch as ‘Guest’ in a manual toggle to indicate when a guest is at home, and this automation makes sure that if I leave home and forget to toggle the GUEST switch and a guest is infact home, based on motion the Guest switch will get switched on automatically, and in extension everything in the house will not switch off confusing the guest lol :smiley: