Template trigger sensor with one way delay (multiple To: conditions)

Hey all!

I’m struggling with my understanding of this and looking for a little help, can’t seem to get what i need through searching and chatGPT and the like.

I’m trying to create a template sensor that is a delay in one direction, but not in the other.

Use Case:
I’m using arpscan on my wife’s phone’s mac to determine when her phone is home. It works relatively well but goes in and out quite a bit. So i want to make an adjacent sensor that has a 6-10 minute delay moving into the “away” state. This would reduce “away” false positives. The “home” side never has a false positive, because when it is in the “home” state it means the mac is on the network. So I would like the “home” to move immediately but the “away” to have a timed “for:” condition.

I tried this yaml below and i’m getting duplicate key errors, so it’s relatively close but not correct:

template:
  - trigger:
      trigger: state
      entity_id: device_tracker.wifePhone
      to: not_home
      for: "00:06:00"
      trigger: state
      entity_id: device_tracker.wifePhone
      to: home
    sensor: 
      - name: ea52_state_delay
        state: >
          {% if is_state('device_tracker.wifePhone', 'not_home') %}
            not_home
          {% else %}
            {{ states('device_tracker.wifePhone') }}
          {% endif %}

Thanks for any help or thoughts!

More than one trigger must be a list, not a dictionary:

template:
  - trigger:
      - trigger: state
        entity_id: device_tracker.wifePhone
        to: not_home
        for: "00:06:00"
      - trigger: state
        entity_id: device_tracker.wifePhone
        to: home

FYI: You don’t need a template sensor for this. You can add the consider_home option to the tracker using manual customisation option to achieve the same thing:

See: https://www.home-assistant.io/integrations/homeassistant/#manual-customization

Awesome, thanks a lot @tom_l I’ll try both ways, appreciate it!