AirTag "integration" (user friendly + device tracker)

Not yet, I’m a windows and android user, have 3 ipads for work only. Shortcuts app it’s a mistery for me, not very user friendly and the online documentation is very vague, to say something positive xd. When I get some results I will put it here to share it with everyone.

By the way, I didn’t say it yet, great work!!

1 Like

GREAT UPDATE!!

Thanks to @marco from aguacatec community i found the way to get the coordinates of the airtag and create a device tracker sensor you can use in your maps :slight_smile: (check first post)

Captura de pantalla 2024-02-10 133646

1 Like

I just updated the code and the guide to make few changes. You can set your address, so:

  • when the find my app says the item is at home, you can get the coordinates.
  • when the item location is in your address, sensor’s value is “Home”

Hi, nice guide congratulations, one thing I didn’t understand, but even if I create the automation the phone still have to be on and unlocked right?

It seems yes, i didnt get it managed to automate the shortcut running at a specific time with a locked iphone. I must always confirm the shortcut to be executed.

Yes, it looks like there is no way to run automations in iPhone if it is not unlocked…

Ok thank you, who knows in the future for now a good starting point.

1 Like

It seems like iOS companion app is going to be improved. All we need is some command to trigger like we do It in Android :slightly_smiling_face:

Nice one! I have setup my two airtags and it seems to work as intended. However, one peculiarity is they both are showing is being Home (fine) but both with an address that is ca. 5 km from the house (definately not Home). I can see that the error is in the coordinates it fetches, which correspond to the address it displays which is not their current location (Home). Has anyone else experienced this?

Would inspect the “show results” mentioned for more info on the data message, but I simply cannot find that action - any advice? Sorry, first time using Shortcuts on iPhone

Hi!

I assume you are using the last version of my code (since you can see the “Home” text). If this is your case, the coordinates come from this part of the code:

{% set home = “FULLADRESS” %}

Is it possible that you didn’t write your address properly?

Hope it helps

You can use “copy to clipboard” too to see the results.

I have the right address. As you can see from my code below, my street name is “Egholmvej” and the street name coming from the coordinates is “Øster Farimagsgade”, so not even close. It is approx. 5 km and in the same city and all, I just don’t see where it would fetch those coordinates from, as it shows correctly in the map on the Find app…?

  - platform: rest
    name: airtag_test
    value_template: "{{ value_json.results[0].formatted }}"
    json_attributes_path: "$.results[0]"
    json_attributes:
      - lon
      - lat
      - district
      - city
      - postcode
      - street
      - housenumber
      - state
      - country
      - country_code
    verify_ssl: true
    scan_interval: 900 # every 15 min
    resource_template: >
      {% set address = states('input_text.airtag').split('Test')[1].split('•')[0] %}
      {% if address == "Hjemme" %}
        {% set home = "Egholmvej XYZ" %}
        {{
          "https://api.geoapify.com/v1/geocode/search?text="
          + home | urlencode
          + "&apiKey=MYAPI&format=json"
        }}
      {% else %}
        {{
          "https://api.geoapify.com/v1/geocode/search?text="
          + address | urlencode
          + "&apiKey=MYAPI&format=json"
        }}
      {% endif %}

And perhaps unrelated, but it does not show on the map either in the lovelace config - not on my home address nor the coordinated address

Hi Tito, that Marco is me :slight_smile:

2 Likes

It looks like Geoapify does not take your address propperly. I suggest you to get into this link and check it. Maybe you can adjust it in order to get the right coordinates.

Good to see you here also my friend!! :slight_smile:

1 Like

Nice. I will try it when the airtag arrives from Ali.
Unfortunately your website post is in Spanish :open_mouth:

It finds the right address, full match with 100% confidence. The coordinates it returns also differ from those populated in the sensors - very odd!

I’ll post it in english as soon as i can :slight_smile:

1 Like

Then test this part of the sensor in templates:

{% set address = states('input_text.airtag').split('ITEM')[1].split('•')[0] %}

And verify that you get exactly the same value that matches 100% your address.