New HA 0.27 and Bluetooth LE tracker

I have a problem to setup the new bluetooth ble tracker. The log shows this:

INFO:homeassistant.util.package:Attempting install of gattlib==0.20150805
Aug 28 18:20:40 ha hass[1480]: Command “/srv/hass/hass_venv/bin/python3 -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-zgzbm5ls/gattlib/setup.py’;exec(comp
ile(getattr(tokenize, ‘open’, open)(file).read().replace(‘\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-uhqmj3v6-record/install-record.txt --single-ve
rsion-externally-managed --compile --install-headers /srv/hass/hass_venv/include/site/python3.4/gattlib --home=/tmp/tmpbprue2xf” failed with error code 1 in /tmp/pip-bu
ild-zgzbm5ls/gattlib/
Aug 28 18:20:40 ha hass[1480]: ERROR:homeassistant.bootstrap:Not initializing device_tracker.bluetooth_le_tracker because could not install dependency gattlib==0.201508
05

How can I solve this?

HA is running on raspberry pi 3 and I have just upgraded with fabric.

Can’t say what the issue is, but I ran into a similar problem with the new html5 notifications. I debugged it by creating a new virtualenv and running the pip install command in that env to see what was missing:

virtualenv tmp_env
. tmp_env/bin/activate
pip install gattlib==0.20150805

And as I discovered, gattlib needs libglib-2.0 dev, bluetooth.h, and boost_python to install. This will get you the first two on Ubuntu:

apt-get install libglib2.0-dev libbluetooth-dev

HOWEVER, on Ubuntu 16.04, and Arch Linux, and anywhere with Python 3.5.x installed, gattlib will currently not install without manual steps.

This is the error:

(home-assistant) hass@t:~$ pip install gattlib
#...
/usr/bin/ld: cannot find -lboost_python-py34
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

And this is how to install it when you get that error:

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 .

There’s an open bug with gattlib here.

3 Likes

Arrgh. I was all excited to try out HTML5 notifications too… guess I should wait and follow this thread.

Did you install libboost-python-dev?

Yes, but gattlib is looking for boost_python34, which is not present.

(home-assistant) hass@tarkin:~$ /sbin/ldconfig -p | grep libboost_python
libboost_python-py35.so.1.58.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libboost_python-py35.so.1.58.0
libboost_python-py35.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libboost_python-py35.so
libboost_python-py27.so.1.58.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0
libboost_python-py27.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libboost_python-py27.so

Ugh, you could try making a manual symlink and see if that will sort things…

I edited my post above to add manual install steps, still via pip, for gattlib on Ubuntu 16.04.

Does anybody know how to do these steps within a virtual environment like the one that the all-in-one-installer creates?

I’m also having same issue. :frowning:

gattlib seems to be a bit complicated to install. As gattlib basically just call hcitool and gatttool, it might be a better option to just call these tools directly without using gattlib. I’m not sure how the core developers will like this idea.

I’ve opened a bug report for this:
https://github.com/home-assistant/home-assistant/issues/3040

1 Like

I’ve updated to v0.27.2, removed bluetooth packages, restarted, re-installed packages, restarted but still getting 16-09-04 09:03:40 homeassistant.bootstrap: Not initializing device_tracker.bluetooth_le_tracker because could not install dependency gattlib==0.20150805

I’m using RPi AIO.

Try manually installing gattlib in your python virtual environment. I posted directions above.

I switched over to hass virtual environment get permission denied using hass system account. When you try sudo and command it asks for hass password but hass is only a system account no password so hitting enter without password will not work.

Did you install the packages that gattlib requires as regular user (pi) with sudo? You should only do the “pip install gattlib” in the hass virtual env.

Worked for me, but I had to use the regular BT tracker, because the BT LE tracker requires root permission (not sure how to set that up).

Packages regular user pi w/ sudo those installed fine, switched over to hass user then switched over to virtual env, I had to back out of pi folder in virtual env to hass folder I was able to download gattlib now got a little further but get this error.

/usr/bin/ld: cannot find -lboost_python-py35
/usr/bin/ld: cannot find -lboost_thread
collect2: error: ld returned 1 exit status
error: command 'arm-linux-gnueabihf-g++' failed with exit status 1

Command "/srv/hass/hass_venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-h7jrikde
build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-rk7a_dph-record/install-record.txt --single-version-externally-managed --compile 
install-      headers /srv/hass/hass_venv/include/site/python3.4/gattlib" failed with error code 1 in
/tmp/ piph7jrikde-build/
(hass_venv) hass@raspberrypi:~/gattlib-0.20150805$

Yeah, I remember that too. You’ll still have to apt-get install libboost-thread-dev (and I think libboost-python-dev) as regular user.

/usr/bin/ld: cannot find -lboost_python-py35
collect2: error: ld returned 1 exit status
error: command 'arm-linux-gnueabihf-g++' failed with exit status 1
(hass_venv) hass@raspberrypi:~/gattlib-0.20150805$ /sbin/ldconfig -p | grep libboost_python
libboost_python-py34.so.1.55.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libboost_python-    py34.so.1.55.0
libboost_python-py34.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libboost_python-py34.so
libboost_python-py27.so.1.55.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libboost_python-py27.so.1.55.0
libboost_python-py27.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libboost_python-py27.so

only error left python-dev is installed as regular user.

Reading state information... Done
libboost-python-dev is already the newest version.

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.