"Not at home for more than 30 minutes" condition

Hi guys. Can anybody help me with a condition templating, please? I would need this one: If device_tracker.NAME status changes to “not_home”, the automation trigger is started to be valid only after 30 minutes. (Easier explanation: When I am not at home for more than 30 minutes, the automation is valid).

Right now I am using this:

- condition: state
      entity_id:
      - device_tracker.name
      - device_tracker.name2
      state: "not_home" 
      for:
        minutes: 30

But I am not sure that it is correct.
Thank you in advance for your help.

Indentation was a bit off:

- condition: state
  entity_id:
    - device_tracker.name
    - device_tracker.name2
  state: "not_home" 
  for:
    minutes: 30

This will be true only if both trackers are not home for 30 minutes. If you want it to be true if either one of the trackers is away for 30 minutes you need to use the OR condition:

- condition: or
  conditions:
    - condition: state
      entity_id: device_tracker.name
      state: "not_home" 
      for:
        minutes: 30
    - condition: state
      entity_id: device_tracker.name2
      state: "not_home" 
      for:
        minutes: 30

Ok, thank you for your help :slight_smile: