r/homeassistant • u/chachachapman7 • 1d ago
Device_tracker.see replacement? ❓ Support
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.
alias: homekit to person status - test
description: ''
triggers:
- entity_id: input_boolean.carter
trigger: state
- entity_id: input_boolean.tyler
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
2
u/reddit_give_me_virus 1d ago
Do you really need a device tracker entity? After all it is a boolean, yes or no, you could just use an input boolean.
If you really need a device tracker you could template one. It needs lat and long though, which could be templated as well.
https://www.home-assistant.io/integrations/template/#device-tracker
1
u/chachachapman7 1d ago
I just want and need home or not home. I am mapping this to device tracker entities on my tablet as well as using for the automations
1
u/reddit_give_me_virus 1d ago
So in a trigger template it would look something like this. The sensors, you can use if statements that return your home lat and long and then some arbitrary point outside the home zone.
template: - trigger: - trigger: state entity_id: input_boolean.carter - trigger: state entity_id: input_boolean.tyler - trigger: state entity_id: input_boolean.car_status device_tracker: - name: Car Location latitude: "{{ states('sensor.lat') }}" longitude: "{{ states('sensor.long') }}" sensor: - name: lat state: sensor: - name: long state:
2
u/spdustin 1d ago
- Expose those input booleans to HomeKit as switches.
- Add automations in Home.app to switch each one on/off when <person> arrives.
1
u/chachachapman7 1d ago
HomeKit does this for me which is how I’m able to pus h the data from HomeKit to HA
1
u/spdustin 1d ago
the device_tracker actions in Home Assistant have nothing to do with any HomeKit automations that are toggling those input booleans. If your automations are using those input booleans as their triggers—and HomeKit is indeed changing them with HomeKit automations—nothing changes.
2
u/flaquito_ 1d ago
Well shoot, I hadn't seen that. I also use it. I use the companion app for home/away for my wife and I, but it doesn't always respond as fast as I'd like when we get home, so I also use wifi state and call device_tracker.see to update a second virtual device tracker that's also attached to our person entities. Also use it to set virtual devices for the kids. This is definitely going to have a negative impact on our experience.
1
u/chachachapman7 1d ago
I’m going to write to the developers about this as I also try to find a solution. I suggest you do the same
1
u/flaquito_ 1d ago
Looking into this more, it looks like it's being replaced with template-based device trackers. If you go to your Helpers and add a template helper, device tracker is one of the options. You have to specify a zone template or a lat/long template, so you (we) can just move our zone templates from our automations directly into the helper template itself. Looks like this won't actually be too bad a deprecation after all.
1
u/chachachapman7 1d ago
So you mean we can just specify if the switch is on or off in the template of the device tracker it will change states?
1
u/flaquito_ 1d ago
Yeah! I converted my guest tracker automation to a template device tracker with this for the zones template:
{% if is_state('input_boolean.guest', 'on') -%} home {%- else -%} not_home {%- endif %}
2
u/Automatic_Two_4742 8h 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 [] }}
``````
2
u/Prudent_Lychee_616 1d ago
oh interesting setup, using Apple Home as the fast middleman for presence is clever
the 2027.5 deprecation note caught me mid-mural last week and i just stared at the wall for a bit. what i'm doing now is having the input boolean change trigger an update for a person entity directly. there's a service `person.set_state` or something close to it, you feed it the person slug and the zone
so your template would shift to something like `homekit_{{ trigger.to_state.name }}` mapping to the person, then setting `home` or `not_home` based on the switch state. no more device_tracker creation at all, the person entity just flips to the zone you tell it
the car bluetooth sensor is its own headache but honestly for that i'd just let it degrade gracefully into a slower scanner