Bluetooth LE Tracker

This tracker discovers new devices on boot and in regular intervals and tracks bluetooth low-energy devices periodically based on interval_seconds value. It is not required to pair the devices with each other!

Devices discovered are stored with ‘BLE_’ as the prefix for device mac addresses in known_devices.yaml.

This platform requires pybluez to be installed. On Debian based installs, run sudo apt install bluetooth libbluetooth-dev pkg-config libboost-python-dev libboost-thread-dev libglib2.0-dev python-dev

Before you get started with this platform, please note that:

  • This platform is incompatible with Windows
  • This platform requires root privileges
  • Don’t use on a Raspberry Pi. It will become unusable slow when using this platform.

To use the Bluetooth tracker in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
  - platform: bluetooth_le_tracker

Configuration variables:

  • device_id (Optional): The device ID for the bluetooth device to be used for tracking. Defaults to hci0.

As some BT LE devices change their MAC address regularly, a new device is only discovered when it has been seen 5 times. Some BTLE devices (e.g. fitness trackers) are only visible to the devices that they are paired with. In this case, the BTLE tracker won’t see this device.

For running Home Assistant as non root user we can give python3 the missing capabilities to access the bluetooth stack. Quite like setting the setuid bit (see Stack Exchange for more information).

$ sudo apt-get install libcap2-bin
$ sudo setcap 'cap_net_raw,cap_net_admin+eip' `readlink -f \`which python3\``

If you have installed Home Assistant with AIO, you need to do the following command, this will grant access to Home Assistant to run the required command.

$ sudo setcap cap_net_raw,cap_net_admin+eip /srv/homeassistant/homeassistant_venv/bin/python3

A restart of Home Assistant is required.

For additional configuration variables check the Device tracker page.