Home Assistant custom component that creates the Device Tracker entity based on templates.
All configuration variables are optional, except name and location.
| Name | Type | Description |
|---|---|---|
| name | string |
The name of the device tracker. |
| location | template |
Defines a template to get the state of the device tracker. The state is home if the template evaluates as True, not_home if False, otherwise template value will be used as is. |
| source_type | template |
Defines a template to get the source_type attribute of the device tracker. |
| unique_id | string |
The unique ID of the device tracker. |
| icon | template |
Defines a template for the icon of the device tracker. |
| picture | template |
Defines a template for the entity picture of the device tracker. |
| attributes | map[attribute: template] |
Defines templates for attributes of the device tracker. |
device_tracker_template:
- name: ESPHome Presence
unique_id: esphome_presence
location: "{{ states('binary_sensor.esphome_ble_presence') }}" # home or not_home
source_type: bluetooth_le
- name: Fake GPS Presence
location: "{{ 'Near Home' if is_state('binary_sensor.some_binary_sensor', 'on') else False }}" # Near Home or not_home
source_type: gpsRecommended method: HACS
- Install and configure HACS
- Open HACS > Three dots in the upper right corner > Custom Repositories
- Add the
dext0r/ha-template-device-trackerrepository (typeIntegration) - Search for and open
Device Tracker Template> Download - Reboot Home Assistant
Manual method:
- Download
device_tracker_template.ziparchive from latest release - Create a subdirectory
custom_components/device_tracker_templatein the directory where theconfiguration.yamlfile is located - Extract the contents of the archive to
custom_components/device_tracker_template - Reboot Home Assistant