Skip to content

Instantly share code, notes, and snippets.

@TitoTB
Last active February 19, 2024 09:16
Show Gist options
  • Select an option

  • Save TitoTB/6a254ee214a6d6223f9a4b48a670705f to your computer and use it in GitHub Desktop.

Select an option

Save TitoTB/6a254ee214a6d6223f9a4b48a670705f to your computer and use it in GitHub Desktop.
This blueprint allows you to turn your AirTag into a Device Tracker. You can read the full guide at https://aguacatec.es/integrar-airtag-en-home-assistant/
blueprint:
name: 📍 AirTag Device Tracker
description: 'This blueprint allows you to turn your AirTag into a Device Tracker. You can read the full guide at https://aguacatec.es/integrar-airtag-en-home-assistant/'
source_url: https://gist.github.com/TitoTB/6a254ee214a6d6223f9a4b48a670705f
domain: automation
input:
airtag:
name: Airtag
description: 'Select the REST sensor you have created for your AirTag'
selector:
entity:
domain:
- sensor
multiple: false
home:
name: Home Address
description: 'Set the word(s) that identifies your home address (i.e. street name)'
default: 'Avocado street'
selector:
text:
trigger:
- platform: state
entity_id: !input 'airtag'
- platform: homeassistant
event: start
condition: []
action:
- variables:
airtag: !input 'airtag'
home: !input 'home'
- service: device_tracker.see
data:
dev_id: "{{ state_attr(airtag, 'friendly_name') }}"
location_name: |
{% if home in states(airtag) %}
home
{% else %}
not_home
{% endif %}
gps:
- "{{ state_attr(airtag, 'lat') }}"
- "{{ state_attr(airtag, 'lon') }}"
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment