AirTag "integration" (user friendly + device tracker)

I had the exact same issue (the check on Home just does not work), I could not figure out how to solve it see AirTag "integration" (user friendly + device tracker) - #146 by john2014

So like I mentioned there, I just changed the location of my Home to be far away. But I can understand that if you are using your iPhone as a daily phone, that that is not a great solution.

Try to add a blank space before and after Home in your template, like this

I address == " Home "

Or you can just remove your home address from your iPhone to get the actual address

Hope It helps

I tried it with a blank space before, but not after yet.
What’s strange is, that the dashboard shows this (with spaces):
image

But if I click on it, there is no space before “Privat
image

However, the state in the dev tools also has the spaces:
image

Interesting find!

I also see
image

But when I click on it, I see
image

seems like some kind of alternative value for the space character.
(i also noticed that the iOS update changed my Home address to my real address again, so I should really find a way to get Home to work :slight_smile: ))

I tried that but failed so far.

I deleted my home adress in my personal details and deleted Home from Apple Maps.
Even after a power cycle of my phone, I still see “Privat” next to my Airtags.

@NCO3 can you try this:

      {% set address = states('input_text.airtag').split('keys')[1].split('•')[0].strip().lower() %}
      {% if  "home" in address %}

this checks if ‘home’ is anywhere in the resulting string. It also strips any spaces and makes it lowercase. I think it is working for me. It will fail in the rare cases that the word “home” is in the actual address, but that is way more rare then my tags actually being at home.

1 Like

Hi John,

thank you very much!
This seems to work, but I still need to investigate a little more to confirm.

What I still dont’t understand is why I still see “Home” in “Find My” even though I have deleted my home address in “Apple Maps” (Favorites) and in “My Card”
:crazy_face:

1 Like

I am in the same situation. I can not, in any way, remove Home anymore. I have deleted my address everywhere. Also tried to make my home location somewhere completely else, but the app keeps on saying Home for the devices (that are indeed home, but I just want it to show the address).

This started I think with the last OS update.

1 Like

Thanks, so it’s not just me - good to know.

And thanks again for your alternative set address stuff. This is a big jump forward.
Much appreciated.

Next objective is to make it work for all airtags (screen swiped upwards).
I still get unknown for the input_text.airtag

1 Like

Hello and thanks to @TiToTB (by the way, your site is awesome) for this great work and especially for the excellent tutorial that makes implementing this solution so easy. For my part, the entire HA part works perfectly for me. The only issue I encounter is with the ‘shortcut’ part. When the screenshot is taken to populate the ‘input_text.airtag’, sometimes the address details are not displayed on the tracking object. I have to click on the object in question for the address to appear. As a result, I get a completely inaccurate and therefore false address. The goal is obviously to automate this, so I am asking for your help to see if there is a way to automatically display the details of the object without any manual action. Thanks in advance for your help.



Sorry for my bad english

1 Like

Hi, I don’t know why but I simply cannot use it anymore. Basically the shortcut runs but input_text.airtag is not populated.

I noticed this in the shortcut.

Can it be related?

1 Like

Thanks!! :blush::blush:

It happens when your airtag has not sent any signal for a while. Current version detects It through ‘:’ character and It should tell you.

To check last known position automatically we need to open every item somehow. For now i haven’t found i way to do that, but i ll try again with new versión.

It seems that you are using an older version of the shortcut, are you?

No I confirm I use latest version. I also deleted previous one and readded from the link in your site and I confirm there is still that voice in spanish “dividir texto” in it

Do you know if your iPhone is getting the info? Even ir It is not send to ha?

Merci pour la précision. Ca me rassure, c’est bien ce que j’avais compris :slight_smile:

Dans ce cas, hâte de voir la suite de ton travail.
Merci encore

1 Like

hello,
I also had probem whit home and had to add a line feed caracter, to get it working

resource_template: >
    {% set address = states('input_text.airtag').split('eze')[1].split('•')[0] %}
    {% if address == "\nDomicile " %}
      {% set home = "251 hugues-pommier, boucherville" %}

but now i got no location in my sensor, the problem is related to the json part

 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
  force_update: true

geoapify return that:


{"results":[{"country_code":"ca","street":"Rue Hugues-Pommier","country":"Canada","county":"Longueuil","datasource":{"sourcename":"openstreetmap","attribution":"© OpenStreetMap contributors","license":"Open Database License","url":"https://www.openstreetmap.org/copyright"},"state":"Quebec","city":"Boucherville","state_code":"QC","lon":-73.455478,"lat":45.590507,"result_type":"street","formatted":"Rue Hugues-Pommier, Boucherville, QC, Canada","address_line1":"Rue Hugues-Pommier","address_line2":"Boucherville, QC, Canada","timezone":{"name":"America/Toronto","offset_STD":"-05:00","offset_STD_seconds":-18000,"offset_DST":"-04:00","offset_DST_seconds":-14400,"abbreviation_STD":"EST","abbreviation_DST":"EDT"},"plus_code":"87Q8HGRV+6R","plus_code_short":"HGRV+6R Boucherville, Longueuil, Canada","rank":{"popularity":5.576076178012012,"confidence":0.5,"confidence_city_level":1,"confidence_street_level":1,"match_type":"match_by_street"},"place_id":"510a83328d265d52c0599087bebb95cb4640c00204e203256f70656e7374726565746d61703a7374726565743a706f6c796c696e653a39333630383738","bbox":{"lon1":-73.455963,"lat1":45.589445,"lon2":-73.45432,"lat2":45.591479}}],"query":{"text":"251 hugues-pommier, boucherville","parsed":{"housenumber":"251","street":"hugues-pommier","city":"boucherville","expected_type":"building"}}}

after getting the input from the shortcut:

input_text.airtag:
eze Domicile • Maintenant Partagé avec Nancy Objets partagés avec moi Chien - 7Ak Avec vous Personnes Appareils Objets Moi

sensor:
latitude: null
longitude: null
status: available
last_update: 26/06/2024 13:31h
icon: mdi:bag-personal
friendly_name: cle_eze

thanks for your help

got it centrered on this


so the eroor is somewhere in there:

##resource: https://api.geoapify.com/v1/geocode/search?text=251%20hugues-pommier%2C%20boucherville&apiKey=95f133a4aaa04d5cba7b0f39ee2d81b7&format=json ## working part

  resource_template: >
    {% set address = states('input_text.airtag').split('*eze')[1].split('•')[0] %}
    {% if address == "\nDomicile " %}
      {% set home = "251 hugues-pommier, boucherville" %}
      {{
        https://api.geoapify.com/v1/geocode/search?text=
        + home | urlencode
        + "&apiKey=95f133a4aaa04d5cba7b0f39ee2d81b7&format=json"
      }}
    {% else %}
      {% set fix = address + " ,boucherville" %}
      {{
        https://api.geoapify.com/v1/geocode/search?text=
        + fix | urlencode
        + "&apiKey=95f133a4aaa04d5cba7b0f39ee2d81b7&format=json"
      }}
    {% endif %}

I just saw that you typed a blank space after “Domicile”. Try to remove It!

also add .strip().lower() to the end of the line, thay way you dont have to be concerned about spaces at the beginning or end, or upper/lowercase. Not sure if it also removes the new line, but you could try this:

{% set address = states('input_text.airtag').split('*eze')[1].split('•')[0].strip().lower() %}
{% if address == "domicile" %}

And I prefer this check as it just checks if the domicile is in the string, so the new line would have no effect.

{% if “domicile” in address %}

1 Like