Components Home Assistant "Device Tracker”

5 minutes of reading
Proconductor: Home Assistant Community
Availability: included in thepersonale HUB Home Assistant
Category: software
Type: components Home Assistant
Implementation difficulties: linked to the chosen integration platform (s)
Card revision: 1.3

The component "Device Tracker” di Home Assistant it is useful to make known to the profirst home automation the presence / absence of tenants in the domotic environment, intended both as individual individuals and as group.

N.b. La domotica personale based on Home Assistant non viola la privacy dei suoi utenti: all information relating to the states (including that of the component “Device Tracker") Are collected LOCALLY and are not transmitted a nessuna realtà esterna. For the more skeptical: Home Assistant it's a projet Open Source, which means that the source code is open, hence its behavior - comprovato - is verificabile by anyone. Obviously any external services used to collect the position are responsible for managing that specific information.

To "tag" the presence of a tenant the hiring is used for which each of them possesses a personal device (usually a smartphone) always connected and that you always carry with you.

GPS PinThe platforms connected to the component "Device Tracker” they are many, offering multiple tracking options to users. Some platforms allow "Only" to identify the state "at home" or "away from home" (Eg. Nmap, integration platform Device Tracker uses the connection of smartphone / tablet devices to the same Wi-Fi/ LAN's Home Assistant to deduce its physical presence - translated: you are connected to Wi-Fi at home, so you're at home), while others use GPS coordinates to identify the point location by the device same.

Some integrations di Home Assistant offer tracking functionality as an accessory feature.
For example, line integration products tado° (for systems management of heating/ cooling), which enables the creation of entity of type Climate, also provides an indirect tracking feature. L 'appmobile communication tado° (For Appthe iOS e Android) asks the user enabling GPS tracking, data that is turned in a secure and authenticated way to the cloud tado° (for features prolandlords of proproducts, for example lo smart heating), cloud which can be consulted by Home Assistant (through the tracker component tado°) to know the position near real-time of users linked to that service.

Absolutely, however, the platform that also offers the best and safest variation of "Device Tracker"Is the platform"Mobile App"Of Home Assistant. This component allows you to control home automation through theapp iOS and Android "Home Assistant Companion”And also detects the GPS position through it.

The complete list of platforms daughters of the component "Device Tracker"Alternatives to" Mobile App"Is available at this address.


We will not refer to specific configurations as, based on the platform used, they vary a lot.

An example presso configuration.yaml relating to the "Fortigate" platform is as follows:

  host: HOST_IP
  username: YOUR_USERNAME
  api_key: YOUR_API_KEY

In the face of a census of a device, an entry comes automatically added to the file known_devices.yaml.
An example:

  name: Marco
  mac: EA:AA:55:E7:C6:94
  track: yes
  hide_if_away: no

The variables included in each entry of the file known_devices.yaml are / can be:

namehostname or “Unnamed Device”The name of device (eg. "Marco")
macnoThe address MAC by the device, in case you use platforms that use it (like Nmap, or SNMP)
picturenoneAn image to identify the person who owns the device. You can add one or more images in the "www" folder at the same level as the configuration.yaml file and use picture: /local/favicon-192×192.png
iconmdi: AccountAn icon, as an alternative to the image, chosen on
GravatarnoneAn image (overridden at "picture") Taken from a Gravatar account. Indicate the email.
trackuse the platform defaultIf set to "true", "yes" or "on", trace the device, otherwise it ignores it.
hide_if_awayfalseIf set to "true", "yes" or "on", hide the device on the frontend when the status is "not_home".
consider_homeuse the platform defaultHow many seconds to wait before setting "not at home" a device after losing track of them.


The basic states possibly associated with a tracker are "home"(At home) or"not_home”(Away from home).

Additional states may be associated in case the platform use the GPS position (for example through theapp Home Assistant Companion managed by the "Mobile" platform App") And are predetermined on configuration.yaml in the"areas"

  - name: Home
    latitude: 42.5335
    longitude: 11.5555
    radius: 300
  - name: Lavoro
    latitude: 42.9935
    longitude: 12.5122
    radius: 200


nameDefines the area.
latitude / longitudeDefine the spatial coordinates.
radiusThe radius, in meters, relative to the area.

More details on the "zones" of Home Assistant are available here.


The trackers can be grouped into one or more groups. Such groups take the status "at home" when at least one tracker is detected in the home, while the state "away from home" is activated when everyone trackers are away from home.

The groupings are convenient for use in automation, or to activate certain scenes, scripts, automation or other against the change of state or as a specific condition.

The groupings are carried out at the item "group”Of the configuration file of Home Assistant configuration.yaml:

    name: Famiglia
      - device_tracker.marco
      - device_tracker.giovanna
      - device_tracker.simone

The names indicated ("marco", "giovanna" etc.) correspond to the "name”Indicated in the file known_devices.yaml (see above).

Use in automation

I device ei tracker groups of tracker can typically be used in automation as "trigger" and how "condition”.


Use "trigger"Allows the user to define an action against a change in status of a tracker and / or a group of trackers.

For example, if I wanted to take action on my return home of any member of the family defined above through the "Family" group, I could use an automation of this type (the sections "condition" and "action"Are deliberately left without valuation to highlight the block of interest, or"trigger"):

- alias: "Ritorno a casa"
    platform: state
    entity_id: group.famiglia
    from: 'not_home'
    to: 'home'
  condition: []
  action: []

If instead I wanted to implement an action in front of the exit of "Marco", I would write something like:

- alias: "Uscita di Marco"
    platform: state
    entity_id: device_tracker.marco
    from: 'home'
    to: 'not_home'
  condition: []
  action: []

The status of trackers and / or tracker groups can be used also as a condition to be verified compared to trigger of an automation.

In the example below, we turn on a light at 7 in the morning, alone in case of presence of someone in the house:

- alias: "Risveglio"
    - platform: time
      at: '07:00:00'
    - condition: state
      entity_id: group.famiglia
      state: 'home'
    - service: light.turn_on
      entity_id: light.sala

Nb On inDomus we have dedicated a guide on the subject of in-home automation (or other areas).

Display on the frontend

Upon activation of the tracking of the device, Home Assistant offers at the frontend the item "Mappa ”, which displays both the position of each device (last surveyed) and any zones defined:

Home Assistant Map - Device Tracker


Regarding the use of "Device Tracker”, We recommend reading the following articles of approelucidation:

Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.

Please comment below