Bluetooth Issues on Raspberry Pi 2

Hi all -

I’m having issues installing my new bluetooth dongle (Plugable USB Bluetooth 4.0 Low Energy Micro Adapter) on my Raspberry Pi 2 so it can work with Home Assistant. When viewing the error log, I see the following:

16-08-11 19:16:44 homeassistant.loader: Loaded device_tracker.bluetooth_tracker from homeassistant.components.device_tracker.bluetooth_tracker

‘16-08-11 19:17:12 homeassistant.components.device_tracker.bluetooth_tracker: Bluetooth devices discovered = 0
16-08-11 19:17:12 homeassistant.components.device_tracker.bluetooth_tracker: No bluetooth devices to track!
16-08-11 19:17:12 homeassistant.components.device_tracker: Error setting up platform bluetooth_tracker’

Based on the error log, it seems like it’s having issues setting up the bluetooth_tracker platform. I’ve installed bluetooth and libbluetooth-dev by running sudo apt install bluetooth libbluetooth-dev and also installed PyBluez by running `sudo pip install pybluez’

I did run into issues when initially starting the bluetooth service:

● bluetooth.service - Bluetooth service Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled) Active: active (running) since Thu 2016-08-11 18:26:01 PDT; 25min ago Docs: man:bluetoothd(8) Main PID: 427 (bluetoothd) Status: "Running" CGroup: /system.slice/bluetooth.service └─427 /usr/lib/bluetooth/bluetoothd

Aug 11 18:26:01 raspberrypi bluetoothd[427]: Bluetooth daemon 5.23
Aug 11 18:26:01 raspberrypi bluetoothd[427]: Starting SDP server
Aug 11 18:26:01 raspberrypi systemd[1]: Started Bluetooth service.
Aug 11 18:26:01 raspberrypi bluetoothd[427]: Bluetooth management interface 1.10 initialized
Aug 11 18:26:01 raspberrypi bluetoothd[427]: Sap driver initialization failed.
Aug 11 18:26:01 raspberrypi bluetoothd[427]: sap-server: Operation not permitted (1)
Aug 11 18:26:12 raspberrypi bluetoothd[427]: Endpoint registered: sender=:1.15 path=/MediaEndpoint/A2DPSource
Aug 11 18:26:12 raspberrypi bluetoothd[427]: Endpoint registered: sender=:1.15 path=/MediaEndpoint/A2DPSink
Aug 11 18:26:14 raspberrypi bluetoothd[427]: Endpoint unregistered: sender=:1.15 path=/MediaEndpoint/A2DPSource
Aug 11 18:26:14 raspberrypi bluetoothd[427]: Endpoint unregistered: sender=:1.15 path=/MediaEndpoint/A2DPSink`

It says Sap driver initialization failed so I went ahead and disabled the Sap driver by editing /etc/systemd/system/bluetooth.target.wants/bluetooth.service and changing ExecStart=/usr/lib/bluetooth/bluetoothd to ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap

So I get this when checking on the status on the bluetooth status now:

● bluetooth.service - Bluetooth service Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled) Active: active (running) since Thu 2016-08-11 19:11:13 PDT; 6s ago Docs: man:bluetoothd(8) Main PID: 2239 (bluetoothd) Status: "Running" CGroup: /system.slice/bluetooth.service └─2239 /usr/lib/bluetooth/bluetoothd --noplugin=sap>

Aug 11 19:11:13 raspberrypi bluetoothd[2239]: Bluetooth daemon 5.23 Aug 11 19:11:13 raspberrypi bluetoothd[2239]: Starting SDP server Aug 11 19:11:13 raspberrypi bluetoothd[2239]: Excluding (cli) sap Aug 11 19:11:13 raspberrypi bluetoothd[2239]: Bluetooth management interface 1.10 initialized Aug 11 19:11:13 raspberrypi systemd[1]: Started Bluetooth service.

Is it me disabling the Sap driver that may be causing my bluetooth dongle not to work with Home Assistant and unable to track any bluetooth devices? or is there something that I’m missing that I forgot to install?

Inside my configuration.yaml, I have the following

- platform: bluetooth_tracker under my device_tracker

Raspberry Pi 2 with Raspberry Jessie
Installed Home Assistant standalone (not the All-in-one package)

Any help is appreciated. Thanks again! After using Home Assistant for over a couple weeks, I’m starting to enjoy how robust this software is and how easy it is to use.

I’ve figured it out based on an old post (Raspberry pi 3 + Bluetooth - #7 by jpenyc). Now, it’s running fine and the bluetooth presence detection seems much more consistent than using nmap. I like it a lot!

1 Like