AirTag "integration" (user friendly + device tracker)

Hello, thanks for creating this project!

I am stuck in the part where i edit the Configuration.yaml
Even thought the code is correct and im not getting any errors, the Sensor.airtag is not created after the restart.

  - platform: rest
    name: airtag_car
    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('Car')[1].split('•')[0] %}
      {% if address == "Home" %}
        {% set home = "HOME ADDRESS" %}
        {{
          "https://api.geoapify.com/v1/geocode/search?text="
          + home | urlencode
          + "&apiKey=MYKEY&format=json"
        }}
      {% else %}
        {{
          "https://api.geoapify.com/v1/geocode/search?text="
          + address | urlencode
          + "&apiKey=MYKEY&format=json"
        }}
      {% endif %}

Is there only a Spanish guide in the first post or I am missing something? It does not look like a simple way to do it.

My browser it auto translates the site.
but I believe that this is a site feature not a browser one.
I suggest to open it in a different one.

Then go to your known_devices.yaml and create yourself. It should work :blush:

Yes, that is correct.

Eventually i want to work in a 2.0 version and post It in native english also

@TiToTB forgive me because I am still figuring out HA. But I am having the same problem as @fitsou. I have done the restart, code is correct, but no entity is showing up. Additionally, after seeing your comment and not being able to find known_devices.yaml, it appears that HA phased this out in 2023 and there is no longer a folder or file known_devices.yaml. Any help would be greatly appreciated.

Is there anyway to run this in the background?

If you don’t have this file yet, you can just create it

No yet, as far as i know

I don’t have the knowledge to create such file.
In what folder do i create it?
what do i write inside?
can you help us please?

You have to create this file using some addon like file editor or samba share, inside the config folder. Then add to the file the code provided in the guide and restart HA

Hey TitoTB i’ve tried but it still didn’t work.
and it make sense since that yaml file is phased out of HA.

any other suggestions?

@TiToTB I am having the same problem as @fitsou. I have file editor and have added a few files before but my knowledge of how to do this is very limited. Your guide is very helpful so far. Can you walk us through what code to add and how to add it to solve this problem of not showing up as an entity?

Sure, this is the code i am referring to:

airtag_ITEM:
  name: airtag_ITEM
  mac:
  icon: mdi:bag-personal 
  picture: local/images/mochila.png 
  track: true

I swear to you guys that i want to get the time to impproved this! I will try to do something in the coming days

2 Likes

@TiToTB add this to the configuration yaml? Or the sensor yaml

:bell:UPDATE:

I finally took my time to implement some improvements:

  • I have changed the approach of the shortcut when extracting information. This way it should work correctly in any language (no need modifications) and it should prevent some fails due to OCR.

  • The guide now includes tips and lessons learned in these months (ie, how to use it with iPads or more than 3 AirTags)

  • I have modified the main sensor, so now you can:
    a) Identify frequent locations (home, work, …)
    b) Limit the address by city, country… and thus avoid false matches.
    c) Identify when the AirTag is unavailable (and show “Last seen…”)
    d) Include sensor’s last update date.

  • Since it has been tricky for some users, creating the device tracker is now optional. In any case, they can use the main sensor that also indicates the address and coordinates.

  • I have included options and tips in the guide on how to implement coordinate updates. I hope it helps you and gives you some ideas.

  • I have written an English version of the guide for the community.

  • In the future, i have some ideas to get the battery level of the AirTag and the last seen address when it get lost. We will see!

  • I have included the link to the printable model of the ‘aguatracker’ in the post, to combine the functions of the AirTag and an NFC keychain (to open doors, trigger automations…) Keep in mind that it is design to perfectly fit this cheap clones, because not all of them has the same chip.

You can read full (english or spanish) explanation and get the codes here:

2 Likes

I hope last update helps you!

Hi,

Can I ask how you were able to add this code into HA, every time I try to add my code, I can’t see the expose sensor for the airtag, I try adding where the configure.yaml & try to add the sensor in where sensor.yaml but still not able to see it in HA, can you shed some light on how you were able to add the code into HA for the sensor?

Hi,

Can you assist with this code, if possible, i am having an issue trying to add this sensor code into HA, I try where sensor.yaml & configure.yaml but not able to see the see sensor for the airtag expose into HA

  • platform: rest
    name: airtag_*Backpack
    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: 120 # every 15 min
      resource_template: >
      {% set address = states(‘input_text.airtag’).split(‘*Backpack’)[1].split(‘•’)[0] %}
      {% if address == “Home” %}
      {% set home = “Providenciales, Turks & Caicos Islands” %}
      {{
      https://api.geoapify.com/v1/geocode/search?text=”

Probably the problem is the name you give to the sensor. You cant use * or uppercase. Try with airtag_backpack