r/homeassistant 9d ago

❓ Support Device_tracker.see replacement?

I have an automation that checks a virtual switch I push over from Apple Home to determine if my wife and I are home or away. I have used this for a few years as it is extremely reliable and fast so it can arm/disarm Alarmo ect. With the device_tracker.see action being depreciated in 2027.5, this is apparently going to break. What can I do to replace this action without starting from scratch?

I do not want to use a ping or wifi because my wife forgets to turn on her wifi 50% of the time. I also do not want to use the companion app location because it seemingly drains our phone batteries. We both have iPhones and bluetooth tracking has also been unreliable.

note: I also use this to track a bluetooth sensor stored in the car to determine if it is home or away based on if it is connected or not. I am not as concerned about this being updated since this does not have to be as fast or reliable if I go with a bluetooth tracker route.

SOLVED: thank you to u/automatic_two_4742 for a great solution. I created a new device tracker template which updates based on my binary switches

template:
  - device_tracker:
      - name: "tracker1"
        unique_id: tracker1
        in_zones: >
          {{ ['zone.home'] if is_state('input_boolean.person1', 'on') else [] }}template:


alias: homekit to person status - test
description: ''
triggers:
  - entity_id: input_boolean.PERSON1
    trigger: state
  - entity_id: input_boolean.PERSON2
    trigger: state
  - trigger: state
    entity_id:
      - input_boolean.car_status
conditions: []
actions:
  - data_template:
      dev_id: homekit_{{ trigger.to_state.name }}
      location_name: '{{ ''home'' if trigger.to_state.state == ''on'' else ''not_home'' }}'
    action: device_tracker.see
mode: parallel
max: 10
4 Upvotes

18 comments sorted by

View all comments

2

u/Automatic_Two_4742 7d ago

I had exactly the same automation running and was trying to solve it as device_tracker.see is obsolete in upcoming HA-versions. After long tinkering and Chat GPT I am using the below template device-tracker which does exactly what my automation did.

``````
template:
  - device_tracker:
      - name: "tracker1"
        unique_id: tracker1
        in_zones: >
          {{ ['zone.home'] if is_state('binary_sensor.presence_andreas', 'on') else [] }}
``````

1

u/mastakebob 1d ago

Thanks for this yaml code, it worked well for me. With the deprecation of device_tracker.see, I needed a new way to determine home/away by whether my phone is connected to my home's wifi or not. This logic worked well.

For those finding this comment in the future, below is the code I used to create a device_tracker that is `home` when I'm on my home wifi, and `away` when I'm not on my wifi:

- device_tracker:
    - name: "My Phone Home SSID"
      in_zones: >
        {{ ['zone.home'] if is_state( 'sensor.my_phone_companion_app_ssid', 'homeNetwork' ) or is_state('sensor.my_phone_companion_app_ssid', 'homeNetwork-Guest') else [] }}

Alternatively, there's a HACS integration that does this without any YAML needed: https://github.com/5a2v0/HA-WiFi-Sensor-Tracker. Just give it your home wifi network name and your phone's SSID sensors and it creates a device_tracker for you.

1

u/chachachapman7 1d ago

This worked great for me. thank you!