New HA 0.27 and Bluetooth LE tracker

Is there a way to know the names for Bluetooth LE devices? I am trying to use my misfit shine band but cant seem to get it to recognize.

I’m a bit surprised that it’s asking for the python 3.5 version. RPi ships with 3.4.2 and my installation of gattlib only asked for libboost_python-py34, so that worked. The posts in the beginning of this thread seem to indicate quite the opposite problem that you seem to be having. So, which python 3 version are you running?

Pi 3 /w latest Raspian used AIO installer. Maybe I ran AlucardZero’s command below that created some sort of symbolic link? I wonder how can I reverse it.

sed -ie ‘s/boost_python-py34/boost_python-py35/’ setup.py

BTW regular BT Tracker is working now. If I can’t get BLE working it’s fine. I like bluetooth tracker better since my Galaxy S7 wifi is set to turn off for power saving.

Yes, sorry, my directions were for Python 3.5 only. If you have Python 3.4, then a simple pip install gattlib should work. Or give more information about why it’s failing.

I got gattlib installed now just unzipped gattlib-0.20150805 again to overwrite sed command written to setup.py script.

@patrickh i’m in same boat as you now ble requires root. I’ll switch back to regular bluetooth tracker for now unless someone knows how to setup via root?

homeassistant.components.device_tracker: Error setting up platform bluetooth_le_tracker
Set scan parameters failed (are you root?)

I am seeing the same root-related error as @dv8ed and no BLE devices in my known_devices.yaml.

The commands I ran to get this far are:

  1. sudo apt-get install libboost-python-dev (as user pi)
  2. sudo apt-get install libboost-thread-dev (as user pi)
  3. sudo su -s /bin/bash hass
  4. source /srv/hass/hass_venv/bin/activate
  5. pip install gattlib

Command 1 and 2 were necessary to stop errors while running command 5. Anything else may have been covered by the work I did to get the regular Bluetooth tracker up and running a while ago (an awesome tracker btw!).

Anybody know how to fix the root-related error?

1 Like

Is this any different from the MQTT room presence tracker using le Bluetooth via room-assistant?

1 Like

You don’t need to run HA with root. I have only allowed python to access the device:
sudo setcap cap_net_raw+eip /srv/hass/hass_venv/bin/python3

4 Likes

That did it for me. BLE is working for me now on the RPI 3.

Same here, it’s working now! Thanks, @hdunst ! :grinning:

I have to say though, I cannot imagine anyone getting the BLE tracker to work using just the info in the docs…

Hmmm I seem to have noticed some side effects, caused by either the Bluetooth LE tracker actually working or by executing sudo setcap cap_net_raw+eip /srv/hass/hass_venv/bin/python3:

  • loading HASS UI became alot slower
  • toggling switches was only effective after 10-15 seconds (e.g. switching off a light), same with executing a script
  • my HASS log file got spammed with connection errors and timeouts (AsusWRT and Chromecast components)
  • automations were randomly no longer triggering

I tried restarting HASS and also my RPi 3 several times, to no avail. Finally I ran the command sudo setcap -r /srv/hass/hass_venv/bin/python3 to undo the command above, and I rebooted my RPi 3 once more. Since then I’ve noticed the following so far:

  • HASS UI is fast once again
  • connection errors and timeouts in the log are gone
  • the root-related errors in the log because of the BLE tracker are back (obviously)

When I have more time, I may test more to see if I can confirm the theory. But right now, it’s bedtime for me.

2 Likes

I was missing libboost-python-dev and libboost-thread-dev to have gattlib installed, source:
https://bitbucket.org/OscarAcena/pygattlib/src/ebcc53523ae8d3b9047eeba8e6899ea448dffc73/DEPENDS?at=default&fileviewer=file-view-default

Run sudo apt install pkg-config libboost-python-dev libboost-thread-dev libbluetooth-dev libglib2.0-dev python-dev which is all the dependencies needed to have gattlib installed.
Then I ran
pip download gattlib tar xvzf ./gattlib-0.20150805.tar.gz cd gattlib-0.20150805/ sed -ie 's/boost_python-py34/boost_python-py35/' setup.py pip install .
from @AlucardZero above, worked on Ubuntu 16.04 with Python 3.5.

4 Likes

So this post really helped me out as I was able to get ble tracking working and saw entries in known_devices.yaml. I live next to a school, I have a guest wireless portal that appears to be a unsecured wireless network, loads of parents decide they’re going to connect. My unifi device tracker was set to track new devices and I forgot to disable that… So yeah. I wiped out all the entries and restarted to regenerate the known_devices.yaml entries, and now nothing.

I’ve tried wiping out gattlib and reinstalling, nope. I can see devices when I do a hcitool lescan. I’ve turned on debug logging on homeassistant.components.device_tracker and just keep the following on restart/reboot:

❨~❩$─► grep -i bluetooth ~/.homeassistant/home-assistant.log
16-09-22 17:56:55 homeassistant.loader: Loaded device_tracker.bluetooth_le_tracker from homeassistant.components.device_tracker.bluetooth_le_tracker
16-09-22 17:59:15 homeassistant.components.device_tracker.bluetooth_le_tracker: No Bluetooth LE devices to track!
16-09-22 17:59:15 homeassistant.components.device_tracker: Error setting up platform bluetooth_le_tracker

RPI3 w/ AIO installer… Does anyone have any idea what I can check or really any troubleshooting tips I can try? Has anyone experienced this before? I’m at a loss.

I am having the exact same problem … Did you find anything new ? Please keep us posted … Thanks !!

Are you talking/asking about the performance issues after running that command and using the BLE tracker? If so, then no: last time I checked, those issues still exist. The only “fix” is not using the BLE tracker, which is causing the performance issues. Running that command itself without the use of the BLE tracker hasn’t caused any issues for me.

Yes I was talking about the performance Issue . So basically is the BLE tracker right ?

Yes, as soon as I include it in my HASS configuration and restart HASS, the performance issues kick in.

That is sad… are you using it on a Raspberry Pi3 ? I have a friend who is running a USB BLE without a problem …

Yep, using a Raspberry Pi 3 and the built-in Bluetooth chip.

EDIT: the documentation for the Bluetooth LE tracker seems to have been updated, so based on that I just ran sudo setcap cap_net_raw,cap_net_admin+eip /srv/hass/hass_venv/bin/python3. After that, I added the tracker to my HASS config and restarted HASS. Unfortunately, the performance issues are back sighs :disappointed:

For me it seems like the performance are related to how much HA should handle.
I have a server running HA which has alot of entities and it has a performance issue when BLE tracker is added.
While my RPI2 with USB BLE that I’m using for testing purpose and it has no problem with performance when BLE tracker is added.