[Solved] Bluetooth not working since 0.94.x

Hi all,

I upgraded to 0.94.x (I am now on 0.94.4) from 0.93.2 and I have issues with Bluetooth (I run hassio aver a raspberry pi 3).

Before 0.94, I had both bluetooth and BLE device tracker working but now here is the message :

Error setting up platform legacy
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 76, in async_setup_legacy
    tracker.see, discovery_info)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 82, in setup_scanner
    for dev in discover_devices():
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 57, in discover_devices
    lookup_class=False, device_id=device_id)
  File "/usr/local/lib/python3.7/site-packages/bluetooth/bluez.py", line 26, in discover_devices
    device_id = _bt.hci_get_route()
OSError: [Errno 19] No such device

For BLE I have 2 messages

No BLE adapter found

and

Error setting up platform legacy
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
    s = os.read(self.child_fd, size)
OSError: [Errno 5] I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/usr/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
    return super(spawn, self).read_nonblocking(size)
  File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 171, in read_nonblocking
    raise EOF('End Of File (EOF). Exception style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 341, in scan
    scan.expect('foooooo', timeout=timeout)
  File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 341, in expect
    timeout, searchwindowsize, async_)
  File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 369, in expect_list
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 117, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 63, in eof
    raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x6ebf15f0>
command: /usr/bin/hcitool
args: ['/usr/bin/hcitool', '-i', 'hci0', 'lescan']
buffer (last 100 chars): b''
before (last 100 chars): b'Invalid device: No such device\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: 1
flag_eof: True
pid: 74
child_fd: 43
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile(b'foooooo')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 76, in async_setup_legacy
    tracker.see, discovery_info)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_le_tracker/device_tracker.py", line 128, in setup_scanner
    update_ble(dt_util.utcnow())
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_le_tracker/device_tracker.py", line 110, in update_ble
    devs = discover_ble_devices()
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_le_tracker/device_tracker.py", line 69, in discover_ble_devices
    devs = adapter.scan()
  File "/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 352, in scan
    raise BLEError(message)
pygatt.exceptions.BLEError: No BLE adapter found

Quite anoying as all my BLE and BT tracking scripts are now useless :frowning:

Does anyone notice the same behaviour on its setup ?

For others that it can help, I found that upgrading HassOS to latest version 2.12 (I was still with HassOS 1.12 !) solved the Bluetooth and BLE issue.

Also, FYI, Bluetooth trackers still use know_devices.yaml in Home Assistant 0.94.x …

1 Like