Device tracker home assistant

Device tracker home assistant DEFAULT

MQTT Device Tracker


The device tracker platform allows you to define new device_trackers through manual YAML configuration in and also to automatically discover device_trackers through a discovery schema using the MQTT Discovery protocol.

YAML Configuration

To use this device tracker in your installation, add the following to your file:

Configuration Variables

Looking for your configuration file?

devices listRequired

List of devices with their topic.

qos integer (Optional)

The QoS level of the topic.

payload_home string (Optional, default: home)

The payload value that represents the ‘home’ state for the device.

payload_not_home string (Optional, default: not_home)

The payload value that represents the ‘not_home’ state for the device.

source_type string (Optional)

Attribute of a device tracker that affects state when being used to track a person. Valid options are , , , or .

Complete YAML example configuration

YAML Usage

To set the state of the device_tracker then you need to publish a JSON message to the topic (e.g., via mqtt.publish service). As an example, the following JSON message would set the device_tracker to :

Discovery Schema

MQTT device_trackers are also supported through MQTT discovery. This is different to the YAML configuration from above. Here, the device_tracker can be created via a discovery topic that follows the following topic name convention: and the JSON message content of a specific format as defined below.

Configuration Variables

Looking for your configuration file?

availability list (Optional)

A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with .

payload_available string (Optional, default: online)

The payload that represents the available state.

payload_not_available string (Optional, default: offline)

The payload that represents the unavailable state.

topic stringRequired

An MQTT topic subscribed to receive availability (online/offline) updates.

availability_mode string (Optional, default: latest)

When is configured, this controls the conditions needed to set the entity to . Valid entries are , , and . If set to , must be received on all configured availability topics before the entity is marked as online. If set to , must be received on at least one configured availability topic before the entity is marked as online. If set to , the last or received on any configured availability topic controls the availability.

availability_topic string (Optional)

The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with .

device map (Optional)

Information about the device this device tracker is a part of that ties it into the device registry. At least one of identifiers or connections must be present to identify the device.

connections list | map (Optional)

A list of connections of the device to the outside world as a list of tuples . For example the MAC address of a network interface: .

identifiers list | string (Optional)

A list of IDs that uniquely identify the device. For example a serial number.

manufacturer string (Optional)

The manufacturer of the device.

model string (Optional)

name string (Optional)

suggested_area string (Optional)

Suggest an area if the device isn’t in one yet.

sw_version string (Optional)

The firmware version of the device.

via_device string (Optional)

Identifier of a device that routes messages between this device and Home Assistant. Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant.

icon icon (Optional)

json_attributes_template template (Optional)

Defines a template to extract the JSON dictionary from messages received on the . Usage example can be found in MQTT sensor documentation.

json_attributes_topic string (Optional)

The MQTT topic subscribed to receive a JSON dictionary payload and then set as device_tracker attributes. Usage example can be found in MQTT sensor documentation.

name string (Optional)

The name of the MQTT device_tracker.

payload_available string (Optional, default: online)

The payload that represents the available state.

payload_home string (Optional, default: home)

The payload value that represents the ‘home’ state for the device.

payload_not_available string (Optional, default: offline)

The payload that represents the unavailable state.

payload_not_home string (Optional, default: not_home)

The payload value that represents the ‘not_home’ state for the device.

qos integer (Optional, default: 0)

The maximum QoS level of the state topic.

source_type string (Optional)

Attribute of a device tracker that affects state when being used to track a person. Valid options are , , , or .

state_topic stringRequired

The MQTT topic subscribed to receive device tracker state changes.

unique_id string (Optional)

An ID that uniquely identifies this device_tracker. If two device_trackers have the same unique ID, Home Assistant will raise an exception.

value_template template (Optional)

Defines a template that returns a device tracker state.

Discovery Example

You can use the discovery protocol to create a new device tracker and set it’s state using the command line tool shipped with or the package to send MQTT messages.

To create the device_tracker:

To set the state of the device tracker to “home”:

Sours: https://www.home-assistant.io/integrations/device_tracker.mqtt/

Device tracker - home_interval or consider_home

I’m a little confused about two options to set up in device_tracker.

I’d like to use tracking without gps, because this drains the battery to fast.

so I think I will chose nmap.

in config.yaml:

home_interval
(integer)(Optional)The number of minutes Nmap will not scan this device, assuming it is home, in order to preserve the device battery.

consider_home
Seconds to wait till marking someone as not home after not being seen. This parameter is most useful for households with Apple iOS devices that go into sleep mode while still at home to conserve battery life. iPhones will occasionally drop off the network and then re-appear. helps prevent false alarms in presence detection when using IP scanners such as Nmap. accepts various time representations, (e.g., the following all represents 3 minutes: , , )

I don’t see the difference and why would home_interval drain the devices battery? Does this wake up the device? I thought I just looks if a device gets online under a certain ip address.

1 Like

Sours: https://community.home-assistant.io/t/device-tracker-home-interval-or-consider-home/
  1. Camper slide out roof cover
  2. Metal and wood shelves
  3. Mini cooper transmission fluid type

Person


The integration allows connecting device tracker entities to one or more person entities. The state updates of a connected device tracker will set the state of the person. When multiple device trackers are used, the state of person will be determined in this order:

  1. If there are stationary trackers (non-GPS trackers, e.g., a router or Bluetooth device tracker) presenting the state , the tracker most recently updated will be used.
  2. If there are trackers of type , then the most recently updated tracker will be used.
  3. Otherwise, the latest tracker with state will be used.

Let’s say, for example, that you have three trackers: , and .

  1. You’re at home, all three devices show state - the state of your Person entity will be with source or , whichever was most recently updated.
  2. You just left home. shows state , but the other two trackers show state (they may not have yet updated due to their setting see device_tracker). Since the stationary trackers have priority, you are considered .
  3. After some time, both stationary trackers show state . Now your Person entity has state ‘not_home’ with source .
  4. While you are away from home, your Home Assistant instance is restarted. Until the receives an update, your status will be determined by the stationary trackers, since they will have the most recent update after a restart. Obviously, the state will be .
  5. Then you’re going into a zone you have defined as , sends an update, and now your state is with source .
  6. You’ve returned home and your mobile device has connected to the router, but hasn’t updated yet. Your state will be with source .
  7. After the update occurs, your state will still be with source or , whichever has the most recent update.

In short, when you’re at home, your position is determined first by stationary trackers (if any) and then by GPS. When you’re outside your home, your position is determined firstly by GPS and then by stationary trackers.

Hint: When you use multiple device trackers together, especially stationary and GPS trackers, it’s advisable to set for stationary trackers as low as possible see device_tracker).

You can manage persons via the UI from the person page inside the configuration panel or via in your file.

Configuring the person integration via the Home Assistant configuration panel

This integration is by default enabled, unless you’ve disabled or removed the line from your configuration. If that is the case, the following example shows you how to enable this integration manually:

Configuring the person integration via YAML

If you prefer YAML, you can also configure your persons via the file:

Configuration Variables

Looking for your configuration file?

id stringRequired

A unique id of the person.

name stringRequired

user_id string (Optional)

The user ID of the Home Assistant user account for the person. (aka ) of users can be inspected in the “Users”/“Manage users” screen in the configuration panel.

device_trackers string | list (Optional)

A list of device tracker entity IDs to track. These will represent the state of the person.

An extended example would look like the following sample:

If you change the YAML, you can reload it by calling the service.

Customizing the picture for a person

You can easily upload a picture in the frontend. Simply click on a person, select or drop an image in the input field, and then crop it.

You can also do this using YAML. By following the instructions on the customizing entities page, you can customize the picture used for a person entity in the section of your configuration. For example:

See the documentation about hosting files for more information about the folder.

Sours: https://www.home-assistant.io/integrations/person/
Ultimate Presence Detection in Home Assistant

Track devices in Home Assistant

Home Assistant has a type of integrations called Device Tracker, these integrations are intended to control the location of the different devices that we linked to our server.

Depending on the integration, this “location” can change completely. To give some examples, you can get the GPS position of a device, indicate which devices are connected to the Internet using the home Wi-Fi network, a list of those visible by a Bluetooth driver connected to the server…

Types of tracking according to use

In general, the types of use that are usually given to this type of integration are the following:

  • Outdoor: Tracking information for an out-of-home device. Normally using the GPS tracker that the device has, its position is sent. Home Assistant has a map to see where it is.
  • Indoor: Tracking information of a device inside the house. Useful for example when you want to know in which room you can find a device.
  • Binary sensor: Informs only if the device is inside or outside the house. Very used to know when a device that is in a fixed position inside the house is turned on (at home) or turned off (outside the house).

Testing integrations

Given the high number of device tracking integrations (presence detection) available in Home Assistant. The best thing to do is to test the integrations we have available from the Presence Detection category.

On my side I have made tests with different integrations trying to guide their use according to the convenience of the device.

Device Tracker Integrations Testing

Bluetooth Tracker

Both the Bluetooth Tracker and its improved variant Bluetooth LE Tracker are quite simple to install, just declare them as a platform in the file.

They use the Bluetooth protocol if available on your server to locate devices within range. Therefore, its use will be of an indoor type. When the server starts it will detect new devices and add them to the file , there is no way to limit it, so if the range of action is near a busy street, in a short time you will have the server storage full of devices you are not interested in.

As a plus, the accuracy is quite high and since it’s a passive detection, the devices do not usually “hide” from the radar. In addition, in other systems such as ESPHome, detection devices can be placed in each room so that we know always the room where the device is located and not only that; from ESPHome we can track only those devices that we want and no scanning of foreign devices is done.

Life

Life is an outdoor mobile device location service. It offers a fairly comprehensive application with user registration and the ability to share locations and other data with other users. It is very easy to use and allows its integration in a visual way () or through YAML.

By contrast, as a third party service, location data is recorded on Life’s servers.

OwnTracks

OwnTracks is the Open Source alternative to Life. While it does not have as many features as its competitor, data is only sent from the mobile applications to a proprietary server, no third party service is used.

Home Assistant by declaring (visually or with YAML) the OwnTracks integration, will create an OwnTracks Webhook server to receive the information securely via HTTP. You also have the MQTT option if you have a dedicated server.

@ChimoC from Telegram’s home automation groups, reports a small bug with the integration of OwnTracks. When doing the configuration, Home Assistant will show a web address to be included in the OwnTracks application like: to which it is necessary to add the server port to make it work: .

Google Maps

The integration with Google Maps is based on taking advantage of Cookies where the GPS positions of a registered device are sent and received to create a location within Home Assistant. Its integration is somewhat complicated. It can be very useful for those people who have Google Maps installed on their mobile and do not want to install another application.

iCloud

If you’re using the Apple ecosystem, integration with iCloud can be very convenient for tracking these devices. Integration can be done visually or using YAML.

On the other hand, at this moment, accounts with a two-factor authentication present problems when being configured.

Mobile App

If you use the Home Assistant mobile application. It has an integration for device tracking. You only need to open the application’s settings in the menu and activate the device’s location services. It will automatically link to the server and start sending location data.

Nmap

Nmap is a network scanning utility. What you get with this internal type of integration is to see which devices are connected to the network by using an ARP scan of the range you specify in the file. Typically, the netmask is , which indicates that the range of available IPs for the devices is one of the last IPs. This means that if, for example, the gateway (Router) IP is , the range of IPs to look for will be from to . This range is indicated with or .

As in many other integrations. Found devices will be saved in and associated with Nmap via their MAC address.

Ping

The Ping integration acts similarly to Nmap, but is targeted at devices that cannot be accessed by ARP. Another point is that Ping does not scan the entire range of IPs, but instead provides a list of IDs and IPs to be tracked using ICMP.

Likewise, the devices will be added to .

In order to use Ping integration it is necessary that the device to track has a fixed IP assigned.

Ghost devices

The integrations related to device tracking are “Best Effort”, that is, they will try to give the best of themselves and give us accurate data, but they will not always succeed.

So, if for example we configure Nmap and Ping for a mobile, we’ll see that it gives contradictory results.

Ghost Devices

This is because some devices get disconnected from Wi-Fi networks to save battery power. Others, even if we leave them in Standby (off, but with light), remain connected to the network, so the sensors will indicate that it is “on”.

The best way to solve this is to use full Home Assistant integrations. For example, in the case of LG televisions, I use webOS TV integration. They are much more accurate, and also provide more functionality. Another way is to try different integrations until you find the most accurate one for that device.

Zones and Areas

Once the position of the devices has been obtained, you can assign labels to locations. For example, a zone that indicates the office where you work so that Home Assistant knows when you are at work, or assign devices to rooms to have an easier management of the devices in the server.

Zones

The zones are designed for the first case. From the Map section, or from , or from the file you can create zones with a GPS position and a range. When the device is in that zone, its tracking status will change to the zone identifier.

Zones Editor

Areas

The areas work in a similar way to zones, except that they act inside the house. They are usually used to define the different rooms and assign devices to them. They can only be configured visually from .

Areas Editor

Attaching devices to people

Once the devices are tracked, Home Assistant users can be linked by creating Person type entities.

These entities have one or more device_tracker associated, in such a way that they complement each other and give the user the most precise situation and with it know where he is at all times.

People Tracking

Simply declare the person in (or via YAML) and assign the device_tracker type entities you want to use. Home Assistant will follow the these rules:

  1. If there are stationary trackers (non-GPS trackers, i.e., a router or Bluetooth “device_trackers”) presenting the status “home”, the tracker most recently updated will be used.
  2. If there are trackers of type “gps”, then the most recently updated tracker will be used.
  3. Otherwise, the latest tracker with status “not_home” will be used.

In other words. When you’re at home, your position is determined first by stationary trackers (if any) and then by GPS. When you’re outside your home, your position is determined firstly by GPS and then by stationary trackers.

Although having several tracking devices configured increases accuracy, the use of these entities for critical operations is not recommended. A correct use is to turn the heating on or off depending on the position of the person for example, but it is not convenient to use it for alarms or doors until enough checks and tests are done.

Conclusion

A tour has been made through the device tracking, configuration and problems. All that remains is to analyze all the devices in the house and add them to the system in order to keep better track of the entire household. In addition, it will be possible to link these integrations to people in order to know where they are at any time.

This and other articles complement the documentation of the GitHub repository where all the configuration of my house is available.

Sours: https://www.danielmartingonzalez.com/en/track-devices-in-home-assistant/

Tracker home assistant device

Nmap Tracker


As an alternative to the router-based device tracking, it is possible to directly scan the network for devices by using Nmap. The IP addresses to scan can be specified in any format that Nmap understands, including the network-prefix notation () and the range notation ().

Please keep in mind that modern smart phones will usually turn off WiFi when they are idle. Simple trackers like this may not be reliable on their own.

If you are running Home Assistant Core in a Python virtual environment, you might have to install the packages for and . On Debian based hosts (for example Raspbian) do so by running . On a Fedora host run .

Configuration

Adding Nmap Tracker to your Home Assistant instance can be done via the user interface, by using this My button:

Manual configuration steps

If the above My button doesn’t work, you can also perform the following steps manually:

  • Browse to your Home Assistant instance.
  • In the sidebar click on Configuration.
  • From the configuration menu select: Integrations.
  • In the bottom right, click on the Add Integration button.
  • From the list, search and select “Nmap Tracker”.
  • Follow the instruction on screen to complete the set up.

An example of how the Nmap scanner can be customized:

Linux capabilities

On Linux systems (such as Hass.io) you can extend the functionality of Nmap, without having to run it as root, by using Linux capabilities. Be sure to specify the full path to wherever you installed Nmap:

And you can set up the device tracker scan options with

See the device tracker integration page for instructions how to configure the people to be tracked.

Sours: https://www.home-assistant.io/integrations/nmap_tracker/
Location-based automations / device tracking in Home Assistant (2021 Guide)

What are the platforms available for device-tracker?

freshcoast:

On the right of the device tracker page is a Category section.

I’m having the exact problem as the OP (albeit with a different router). I’m unable to find a Device Tracker page to see which integrations are available for presence detection, though… I’m looking through the UI to find the Presence Detection category but I can’t see it anywhere. Help?

EDIT: I found that my Asus router is an available integration through the HA website, but not through the UI. I added it to and added as my platform, like so:

It all checks out in my “Check Configuration” in the UI… but I still don’t know where to find the Presence Detection category. I should state that I already have the UPnP integration for my router that HA auto-detected when I first started it up yesterday… I don’t know if that would cause a conflict, but I’d still expect the Asus integration to show up.

Sours: https://community.home-assistant.io/t/what-are-the-platforms-available-for-device-tracker/

You will also be interested:

Device Tracker


The device tracker allows you to track devices in Home Assistant. This can happen by querying your wireless router or by having applications push location info.

Configuring a device_tracker platform

To get started add the following lines to your (example for Netgear):

The following optional parameters can be used with any platform:

Device tracker will only look for the following global settings under the configuration of the first configured platform:

ParameterDefaultDescription
12Seconds between each scan for new devices. This only applies to local device trackers, not applications that push updates.
Seconds to wait till marking someone as not home after not being seen. This parameter is most useful for households with Apple iOS devices that go into sleep mode while still at home to conserve battery life. iPhones will occasionally drop off the network and then re-appear. helps prevent false alarms in presence detection when using IP scanners such as Nmap. accepts various time representations, (e.g., the following all represents 3 minutes: , , )

Note that setting will still result in new devices being recorded in , but they won’t be tracked ().

The extended example from above would look like the following sample:

Multiple device trackers can be used in parallel, such as Owntracks and Nmap. The state of the device will be determined by the source that reported last.

known_devices.yaml

As of is being phased out and no longer used by all trackers. Depending on the integration you use this section may no longer apply. This includes OwnTracks, GeoFency, GPSLogger, Locative and Huawei LTE.

Once is enabled, a file will be created in your configuration dir named . Edit this file to adjust which devices to be tracked.

Here’s an example configuration for a single device:

In the example above, refers to the detected name of the device. For example, with , this will be the MAC address (with byte separators omitted).

ParameterDefaultDescription
Host name or “Unnamed Device”The friendly name of the device.
NoneThe MAC address of the device. Add this if you are using a network device tracker like Nmap or SNMP.
NoneA picture that you can use to easily identify the person or device. You can also save the image file in a folder “www” in the same location (can be obtained from developer tools) where you have your file and just use . The path ‘local’ is mapped to the ‘www’ folder you create.
mdi:accountAn icon for this device (use as an alternative to ).
NoneAn email address for the device’s owner. If provided, it will override .
[uses platform setting]If // then the device will be tracked. Otherwise its location and state will not update.
[uses platform setting]Seconds to wait till marking someone as not home after not being seen. Allows you to override the global setting from the platform configuration on a per device level.

Device states

The state of your tracked device will be if it is in the home zone, detected by your network or Bluetooth based presence detection. If you’re using a presence detection method that includes coordinates then when it’s in a zone the state will be the name of the zone (case sensitive). When a device isn’t at home and isn’t in any zone, the state will be .

device_tracker.see service

The service can be used to manually update the state of a device tracker:

Service data attributeOptionalDescription
noThe , for example for
yesThe location, , , or the name of the zone
yesThe hostname of the device tracker
yesThe MAC address of the entity (only specify if you’re updating a network based tracker)
yesIf you’re providing a location, for example
yesThe accuracy of the GPS fix
yesThe battery level of the device
Sours: https://www.home-assistant.io/integrations/device_tracker/


215 216 217 218 219