Great idea.
This is even more relevant now with the Person component being limited to device trackers.
I, like many others, use Apple Homekit to track my location as it’s more reliable than any other iPhone solution (including the iOS app) - effectively using an automation in HomeKit to flip an input boolean, relying solely on Apple’s native location tracking.
I then use that input_boolean’s state to determine if I’m home or not for other automations. There’s currently no simple way of getting this information into the device_tracker component, and hence the Person component.
I have been using the Apple Homekit Binary Input trick since I have been using Home Assistant.
It would be very helpful to have a template device_tracker. With the ability to consider multiple dis-similar input types I can write the logic to determine the device_trackers state. This would be a wonderful feature to have.
ooh yes please, i’ve been investigating this route too.
I’m currently using a regular sensor template to achieve a sensor.whatevername with the state of home/away
This seems like the new people
concept tackles this problem. You can combine multiple sensors to represent the home/away state of a person
, such as combining Bluetooth, wifi, and GPS together to determine the presence of a person.
Well yes, but actually no )
Under Person you can combine only different entities of device_tracker platform. And there is no way to make some device_tracker to be home by some input_boolean for example =(
Totally agree, just figured out I’m having the same issue. I would like to ust Fingbox + IFTTT + Nabucasa Webhook to transport and set a custom device tracker. Sounds crazy, but Fingbox detection works well, since it has no local API I need to use IFTTT and to get the information back it would be a webhook…
Anyways having the ability to configure a custom device_tracker.* from a template would be awesone, as status could be change by whatever integration you have/do.
You can do this with the device_tracker.see
service https://www.home-assistant.io/components/device_tracker/#device_trackersee-service
simple binary example
automation:
- id: '123456789'
alias: Custom Tracker
trigger:
- entity_id: binary_sensor.richard
platform: state
- event: start
platform: homeassistant
action:
- data_template:
dev_id: richard
location_name: >
{% if is_state('binary_sensor.richard', 'on') -%}
home
{%- else -%}
not_home
{%- endif %}
service: device_tracker.see
credit goes to @apop from here: Device tracker from script?
to be clear just helping out @jensihnow so they are not stuck behind this feature request, I still agree a template device tracker would be more intuitive and canonical with other entity types.
I agree a template device tracker is very much desired. I am using Monitor BLE in addition to Router and GPS based trackers and trying to combine them without a template gets very ugly.
The need for this is especially apparent now that we have the person presence detection method as it requires the use of device_tracker entities.
Yeah. I need to create a device tracker from multiple other entities - sensor
s, two media_player
s and another device_tracker
. And can’t cuz this’ still not implemented
This can be solved with implementing template device_tracker. It even can be binary - ‘home’ if template returns True
else ‘not_home’
I can only concur, but for those interested, I found a workaround that works for me: I add my ‘virtual device’ in the known_devices.yaml
file, then set its value with automations and the device_tracker.see
service.
But this solution is at risk, see here.
A viable alternative would be the use of a virtual MQTT device tracker (which doesn’t already use know devices) with the device_tracker.see
service
Will it work without setting up MQTT as such? I am not using it.
With known_devices.yaml being depreciated, how do you create new device trackers? I want to track/plot my vehicles on a map when we leave them parked. I have a node red flow that detects when I connect/disconnect from my truck, but I want it to then pull my location and save it to an entity to track my truck’s location. But I can’t figure out how to do this without the known_devices config.
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
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.
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.
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