Bluetooth problems

I’ve been using the Bluetooth presence tracker for quite some time, but lately, I’ve been having more problems than ever before. I’m running Home Assistant in a pyenv on a Raspberry Pi 3B. I see a few other posts about this, but nothing has a solution. My Bluetooth tracker works for a while (lately, down to a few hours) and then stops detecting devices. If I restart Home Assistant, restart the RPi, or log in and run bluetoothctl and do a “scan on” and “scan off” it will start detecting devices again. The problem repeats in a few hours.

I’ve looked through the logs and don’t really see anything that corresponds to when the problems start. I do get Bluetooth errors, but they are at different times than when I’m losing devices. The only Bluetooth-related log entries I see are:

Jul  3 06:33:53 home kernel: [604650.442264] Bluetooth: hci0: Frame reassembly failed (-84)
Jul  3 06:33:55 home kernel: [604652.505296] Bluetooth: hci0: command 0x0401 tx timeout
Jul  3 06:34:09 home hass[13945]: 2019-07-03 06:34:09 ERROR (SyncWorker_8) [homeassistant.components.bluetooth_tracker.device_tracker] Error looking up Bluetooth device
Jul  3 06:34:09 home hass[13945]: Traceback (most recent call last):
Jul  3 06:34:09 home hass[13945]:   File "/srv/homeassistant/lib/python3.7/site-packages/bluetooth/bluez.py", line 31, in discover_devices
Jul  3 06:34:09 home hass[13945]:     lookup_class=lookup_class, device_id=device_id)
Jul  3 06:34:09 home hass[13945]: _bluetooth.error: (110, 'Connection timed out')
Jul  3 06:34:09 home hass[13945]: During handling of the above exception, another exception occurred:
Jul  3 06:34:09 home hass[13945]: Traceback (most recent call last):
Jul  3 06:34:09 home hass[13945]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/bluetooth_tracker/device_tracker.py", line 102, in update_bluetooth_once
Jul  3 06:34:09 home hass[13945]:     for dev in discover_devices():
Jul  3 06:34:09 home hass[13945]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/bluetooth_tracker/device_tracker.py", line 57, in discover_devices
Jul  3 06:34:09 home hass[13945]:     lookup_class=False, device_id=device_id)
Jul  3 06:34:09 home hass[13945]:   File "/srv/homeassistant/lib/python3.7/site-packages/bluetooth/bluez.py", line 34, in discover_devices
Jul  3 06:34:09 home hass[13945]:     raise BluetoothError ("error communicating with local "
Jul  3 06:34:09 home hass[13945]: bluetooth.btcommon.BluetoothError: error communicating with local bluetooth adapter

It lost the devices again around 2:30 AM 4 July, but there weren’t any log entries at that time. The closest one was a frame reassembly failed at 2:16 AM and there were other entries that didn’t affect the BT tracker.

I can’t figure out if I’m having a hardware failure or if this is a problem with the BT tracker. I’m not convinced it is hardware since I can get it working again by running “bluetoothctl”

I used to have very reliable and very good Bluetooth detection, but now it’s very annoying as it is frequently marking me as “away” when I’m still home, especially at night while I’m asleep.

Any suggestions?

I had a terrible time with the Bluetooth tracker in HA and started using Andrew J Freyer’s Monitor script instead…works perfectly.

Andrew J Freyer’s Monitor script looks like it is BluetoothLE. Home Assistant has support for both Bluetooth and Bluetooth LE trackers. Based on my configuration file, I’m using the Bluetooth tracker, which, I think gets me the range I need throughout my house.

I haven’t tried also adding the Bluetooth_LE tracker to my configuration file, but this seems like the Bluetooth tracker should work. In fact, I was having great success with this, but I’m not sure what changed.

Surely, there are other people using the Bluetooth tracker for presence detection?

This appears to be the issue mentioned here:

https://github.com/home-assistant/home-assistant/issues/24045