User can make own device_tracker

Call a service:

      service: device_tracker.see
      data:
        dev_id: fake_tracker
        gps:
          - 55
          - 55
        gps_accuracy: 10

And see a new entity created:

which can be shown on a Map:

Means - there is no need to use integrations creating virtual device_trackers.
I wonder - is it by a design?

I was going to say it probably doesn’t survive a restart but, surprise, it does.

Now that I have created it, I’m trying to find a way to delete it …

  • The entity doesn’t have a unique_id so it can’t be deleted via the UI.

image

  • It wasn’t created via YAML so there’s no configuration to delete.

  • It has no associated Device Tracker integration so it can’t be deleted via Settings → Devices & Services → Integrations → ???

I ended up manually deleting references to it in the following files and then restarting.

  • known_devices.yaml
  • homeassistant.exposed_entities

Given the challenge of deleting it, my guess is that the service call wasn’t meant for creating a device_tracker entity (because if it was, they overlooked to make it easy to delete the entity).

Thanks for a feedback.

Deleting here seems to be enough.

So far I see no harm from this manually created entity.
It can be used in some ways.

Noticed this behaviour recently:

  1. Installed a Virtual integration which created some “device_tracker.virtual_tracker” entity.
  2. Created an automation which moves this tracker to some random coords periodically.
  3. Uninstalled the Virtual integration.
  4. Got surprised that my tracker still exists.

Interesting. It wasn’t enough in my case, even after performing a Ctrl+F5 in my browser to ensure I wasn’t looking at cached data. It only disappeared after editing the JSON in the second file. Maybe my testing procedure was flawed and I saw a false positive some how. :man_shrugging: Anyways, I won’t be experimenting with that service call again.

There never was… you could just add manual entries to known_devices.yaml.

1 Like

I’m going crazy about this: I have a gps on my boat that collect data on position with a ESP32 and send them to my HA.
Now how can I create a device_tracker that gets that data ?
Please help me with the sintax about this,
Thank you

How are the lat. and log. coordinates currently represented in HA? We need to know what we are starting from to answer your question.

The basic answer is that you set up an automation that triggers off changes to whatever entity or entities hold the lat. and long. values, then you use the device_tracker.see action with templates that extract the desired data.

ok about device_tracker.see, but what is the step before, when I create the entity?

In other words: I get lat & lon via MQTT and create two entities with red node, “dimmi_lat” and “dimmi_lon”

DimmiLON 10,519349°
DimmiLAT 43,635017°

then I want to create a device.tracker that use the two datas
then I think I may create a person to view on map, located at that coordinate
But what is the syntax to build the device.tracker?

You don’t need to create anything, the action itself will cause the entity to be created as long as you use a unique dev_id… The dev_id will become the object ID of the device_tracker entity.

Do you mean that I don’t need to write anything in configuration.yaml ?
:weary:

Correct. You do not need to add anything to configuration.yaml.

It wouldn’t hurt to check the config directory to make sure that the file known_devices.yaml exists; and if doesn’t create a blank file with that name.

known_device.yaml did not exist, I’ve created the blank file. But you talk about an automation ? do I have to create it? how? :pray:

How do you normally create your automations?

You mentioned NR earlier… I haven’t used it in a couple years, but I assume there is still a “call service” node (or something equivalent). Pipe the lat and long data from MQTT into a call service node for the device_tracker.see service.