How to create a custom device or person tracker?

I’ve been searching and can’t find exactly what I need to address my need. Here’s my problem: I would like to create a custom device tracker to map to persons in my HA setup. The way I want to determine if someone is Home or Not Home would be based on custom attributes that have nothing to do with GPS coordinates or Wifi connections or whatever. Instead, I maintain some custom states in a helper input_text variable and want to use that as a way to decide if someone is to be considered home or not.

How could I achieve that? Is the idea to create a custom device tracker the right one? Is there another way to do this?

Thanks in advance!

Create a custom device_tracker and use service calls from automations or scripts to set the state of it

Thanks for the prompt response. Would you have a pointer on how to create a basic device_tracker and how to manually update its state? I read a bunch of posts on this vu nowhere could I find a way to do this very basic stuff. Thanks!

Official docs are your friend here:

Device Tracker - Home Assistant (home-assistant.io)

Configure a tracker in yaml, use the device_tracker.see service to set its state.

Thanks and I did read the documentation, and honestly, this is either very incomplete or assumes existing familiarity with the concept of device tracker.

For instance, I get that I need to create a device tracker and set its state manually, and that somewhere device_tracker.see needs to be used to do that, great.

1/ How do I create the device tracker in the first place? Each example seem to use a given platform (eg. mqtt or ping), but in my case, the device tracker needs to be virtual, and its state will be set depending on the value of helper input_text strings. What platform do I use? What would be a mock definition for me to work from to help define the kind of tracker I need?

2/ How do I invoke device_tracker.see and are there examples I can look at? Again I looked online and the very few discussions on the topic just don’t provide what I need here.

Sorry if this is very newbie-level, I’ve done quite a bit with HA already, including tons of Node Red automation, as well as regular HA automation, but the device tracker space seems strange and quite under documented compared to other aspect of the platform.

I promise to share my results once I get this figured out as I expect others are equally puzzled. Thanks!

1 Like

I solved this by using the mqtt device tracker capability, will post my solution soon here.

Another option is as follows

1 Like