Trigger automation depending on position of the device

Hello all,

I want to open my garage door by scanning an NFC chip with my mobile phone.
The NFC chip will be placed in the car, so it is moving.
To avoid that the door is opened accidentially by placing the phone on the tag I want to check if the mobile phone is next to the home.

This means

  • If I scan the tag with Mobile Phone A I want to check the position of phone A.
  • If I scan the tag with Mobile Phone B I want to check the position of phone B.

In other words, I need the ID of the phone that triggered the automation.

I have absolutely no clue how to start.

Thank you :slight_smile:

You can see what zone the phone, or more likely the person that is tracked by the phone they are carrying is in.

One of the conditions is the phone(person) is home.

not sure to understand the answer correct:

I can add a condition that phone(person A) is in the zone “Home”. But how do I check which persons phone triggered the automation?

You need to create a dictionary that links the device_id from the tag_scanned event to the person or device_tracker.

  - platform: event
    event_type: tag_scanned
        abcdefg123456: person1
        123456abcdefg: person2
      active_person: "{{ device_people.get( }}"
  - condition: template
    value_template:  |
      {{ is_state('person.'~active_person, 'home') }}

That. or I was thinking of using the person screen in the UI where you just tell it what devices are actually you.

Open your Home Assistant instance and show a list of your people.