Change state of device tracker

I want to change the state of my phone device tracker to either home or not_home. I saw a solution to this at
https://community.home-assistant.io/t/how-to-change-device-tracker-state/333161

@rccoleman

You can’t change the state of a person - a person is a group of device_tracker entities combined into a single state based on the logic in the docs. Creating or changing the state of a device_tracker is simple:

- service: device_tracker.see
    data:
      dev_id: somename
      location_name: "{{ 'home' if something else 'not_home' }}"

That will either create device_tracker.somename or change the state to whatever that template evaluates to. Add that device_tracker to your person and done. Or just use the device_tracker entity directly.

My case - Want to change state of device_tracker.sm_s921u (my phone)

So I try an automation with:

- service: device_tracker.see
    data:
      dev_id: sm_s921u
      location_name: "{{ 'not_home' }}"

Automation runs without trace errors but does not change the sate of phone (was ‘home’ to start).

Also tried:

- service: device_tracker.see
    data:
      dev_id: sm_s921u
      location_name: not_home

What have I done wrong? Thanks for any help.

For starters that doesn’t look like a valid device tracker entity in the dev_id:attribute

The example in the doc:

(scroll down to the .see action) that entry points to a valid device_tracker entity (which would be your phone)

The format in the ref I noted only wanted the device name. However I have tried the complete name device_tracker.sm_s921u as well and it also does not work. The device tracker works fine for gps locations etc, so not an issue with it.

In the device_tracker.see action section of Device Tracker it has:

Data attribute	Optional	Description
dev_id	no	The object_id, for example tardis for device_tracker.tardis

It wants the object_id which is tardis for the example device_tracker.tardis. For me it is sm_s921u for device_tracker.sm_s921u as I read it.

1 Like

I finally traced this to Github and was informed that:

The device_tracker.see service is only applicable to legacy device tracker platforms. Not modern config entry based device trackers.

Device trackers that track phones coming from the mobile app integration use the modern device tracker implementation.

Looking at the “modern” version, it appears you cannot manually change the state of a device tracker. There are no services for the modern device tracker.

Would be nice if the Device Tracker documentation was update to reflect this.