Bluetooth Presence Tracker Error

Today, for some reason, my Bluetooth presence detection stopped working. I am seeing this error repeated in the Log file:

16-12-20 17:04:54 homeassistant.components.device_tracker.bluetooth_tracker: Error looking up bluetooth device!
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/bluetooth/bluez.py", line 289, in _gethcisock
    sock = _bt.hci_open_dev (device_id)
_bluetooth.error: no available bluetoot devices

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/bluetooth_tracker.py", line 79, in update_bluetooth
    result = bluetooth.lookup_name(mac, timeout=5)
  File "/home/hass/.homeassistant/deps/bluetooth/bluez.py", line 61, in lookup_name
    sock = _gethcisock ()
  File "/home/hass/.homeassistant/deps/bluetooth/bluez.py", line 291, in _gethcisock
    raise BluetoothError ("error accessing bluetooth device")
bluetooth.btcommon.BluetoothError: error accessing bluetooth device
16-12-20 17:05:25 homeassistant.components.device_tracker.bluetooth_tracker: Error looking up bluetooth device!
Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/bluetooth/bluez.py", line 289, in _gethcisock
    sock = _bt.hci_open_dev (device_id)
_bluetooth.error: no available bluetoot devices

Nothing has changed in my configuration, it was in fact, working this morning, then I restarted HA to load a change to my configuration to configure a new motion sensor and it has not worked since.

I ran some checks to see if I could figure out the state of Bluetooth on the Pi (and I am running Jessie Lite) and its acting or seemingly indicating Bluetooth is not even installed, yet it is.

sudo bluetoothctl

[bluetooth]# agent on
Agent registered

[bluetooth]# default-agent
Default agent request successful

[bluetooth]# power on
No default controller available

[bluetooth]# scan on
No default controller available

$ cat /etc/group | grep bluetooth
bluetooth:x:113:pi

I thought I would bump this to see if anyone has any ideas. I am still seeing errors in the logs on each restart of HA

16-12-21 21:10:41 homeassistant.components.device_tracker: Error setting up platform bluetooth_tracker
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/__init__.py", line 159, in async_setup_platform
    None, platform.setup_scanner, hass, p_config, tracker.see)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/bluetooth_tracker.py", line 61, in setup_scanner
    for dev in discover_devices():
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/bluetooth_tracker.py", line 39, in discover_devices
    lookup_class=False)
  File "/home/hass/.homeassistant/deps/bluetooth/bluez.py", line 26, in discover_devices
    device_id = _bt.hci_get_route()
OSError: [Errno 19] No such device

Yup, getting the same errors. Also, devices are not being stored in known_devices.yaml. Running HA 0.35.2.

Okay, well, at least I am not alone. I thought I had perhaps broken my setup somehow.

My Bluetooth devices are also not being stored in known_devices.yaml and I am getting similar errors in my error log. Hopefully someone is listening to this, but not sure considering I’m on 0.35.3 and it still doesn’t work.

pi@raspberrypi:~ $ sudo bluetoothctl
[NEW] Controller 00:02:72:C8:85:2B raspberrypi [default]
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:02:72:C8:85:2B Discovering: yes
[NEW] Device F8:85:7C:13:CB:90 LockF8857C13CB90
[NEW] Device 00:DB:DF:9B:AB:17 EMEVTH-TABLET
[CHG] Device F8:85:7C:13:CB:90 RSSI: -71

I mahde the test an no errors but no Devices in Hass.
I found another threat to maybe fiy your problems guys. Try this first:

1 Like

Hey guys. Just got BT tracker runing properly by replacing the this file: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/device_tracker/init.py

Rebooting the system and will update if needed :slight_smile: