Template device_tracker

What you can do is to mis-use a device tracker created for a device that doesn’t move, and update it via automation. I used a device_tracker for the dishwasher that the router created to track the location of the dog …

Actually, this doesn’t seem to work anymore, because a device_tracker cannot be updated via automation as far as I can see.

But template device tracker would be cooler :slight_smile:

The device tracker.see service isn’t working? Docs say it should…

Actually, it does, I was mistaken earlier, sorry. So this trick still works.

1 Like

How do you create a new device_tracker then? Or is that still not possible, only updating existing?

One will be created when you call the device_tracker.see service.

Another option is to use the custom integration Composite Device Tracker to create a device tracker based on a binary sensor.

1 Like

The method I have been using for years is to create mqtt device trackers and mqtt switches that use the same topic. The switches are passed to Homekit to turn on and off with automations when you leave or arrive. This removes the automations in homeassistant and if you turn on the retain it is always correct when homeassistant is rebooted. Like so:

mqtt:
  device_tracker:
    - name: Charlies Homekit
      unique_id: charlies_homekit
      state_topic: occupancy/charlies_homekit
      source_type: gps
      payload_home: home
      payload_not_home: away
  switch:
    - name: Charlies Homekit
      device_class: switch
      state_topic: occupancy/charlies_homekit
      command_topic: occupancy/charlies_homekit
      payload_on: home
      payload_off: away
      retain: true