Just after Xmas moved my HA from my PC to a dedicated Rpi 4, and yesterday realised that the pi has Bluetooth built in (doh!), so removed the Bluetooth dongle.
Now, Bluetooth isn’t activated with the looks of it?
Any help appreciated.
Logs:
File “/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py”, line 63, in discover_devices
result = bluetooth.discover_devices(
File “/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py”, line 34, in discover_devices
raise BluetoothError ("error communicating with local "
bluetooth.btcommon.BluetoothError: error communicating with local bluetooth adapter
2022-01-27 09:45:28 ERROR (MainThread) [homeassistant.components.bluetooth_tracker.device_tracker] Error looking up Bluetooth device
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py”, line 30, in discover_devices
results = _bt.hci_inquiry (sock, duration=duration, flush_cache=True,
_bluetooth.error: (110, ‘Operation timed out’)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py”, line 156, in perform_bluetooth_update
devices = await hass.async_add_executor_job(discover_devices, device_id)
File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 52, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py”, line 63, in discover_devices
result = bluetooth.discover_devices(
File “/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py”, line 34, in discover_devices
raise BluetoothError ("error communicating with local "
bluetooth.btcommon.BluetoothError: error communicating with local bluetooth adapter
2022-01-27 09:45:35 ERROR (SyncWorker_20) [switchbot] Error scanning for switchbot devices
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/switchbot/init.py”, line 147, in discover
devices = bluepy.btle.Scanner(self._interface).scan(
File “/usr/local/lib/python3.9/site-packages/bluepy/btle.py”, line 854, in scan
self.stop()
File “/usr/local/lib/python3.9/site-packages/bluepy/btle.py”, line 803, in stop
self._mgmtCmd(self._cmd()+“end”)
File “/usr/local/lib/python3.9/site-packages/bluepy/btle.py”, line 312, in _mgmtCmd
raise BTLEManagementError(“Failed to execute management command ‘%s’” % (cmd), rsp)
bluepy.btle.BTLEManagementError: Failed to execute management command ‘scanend’ (code: 11, error: Rejected)
2022-01-27 09:45:35 WARNING (SyncWorker_20) [switchbot] Error scanning for Switchbot devices. Retrying (remaining: 3)
According to a post as long as ttyAMA0 is not being used by any other device it should just work - ZigBee and Z-Wave are using other ports, and there is no other dongle attached.
In my experiences with a rpi3 the bluetooth is very touchy, so I’m not sure if that carry’s over to the rpi4. I would stick with the bluetooth dongle, and if you have an extension cable that you can plug it into, to get some distance from the rpi4 that will help too, cause the rpi can cause interference.
So… gave up with the Rpi bluetooth and put dongle back in, working again. The Rpi bluetooth does seem not to be 100% with HA looking at the many posts.
I’ve got the same issue. But in my case, internal RPi Bluetooth was working perfectly since 4 years. First on RPi3, then on RPi4 since about 1 year.
I think last HA update broke my bluetooth, no other changes on my hardware or software.
I think an external bluetooth dongle is a bad solution until the root cause is not understand.
Not sure if this helps: I recently started using Bluetooth on rPi 4, and it didn’t work.
I then remembered I disabled wifi and Bluetooth when I initially set it up as I didn’t use it back then by adding these lines in /boot/config.txt:
# Disable WiFi
dtoverlay=disable-wifi
# Disable Bluetooth
dtoverlay=disable-bt
After commenting out these lines, Bluetooth is working fine again.
I’ve just moved to a RPi 4 so decided to experiment with the bluetooth for presence detection, so maybe not quite the same as I’ve been starting from scratch with no previous bluetooth, but I thought I’d chip in to see if that’s of any help.
I followed the guide with installing the drivers:-
sudo apt install bluetooth libbluetooth-dev
I also did the Bluetooth_LE install as well although have now commented that out of configuration.yaml, but that also installed drivers and gave rootless access to the bluetooth stack, so again not sure if that made mine work?
It took me a while to get the RPi to initially detect my phone bluetooth (hence all the messing round with LE), but after I’d done all that and then restarted the pi whilst having the phone in pairing mode it finally created my known_devices file complete with the phone details etc.
Since then it seems to have been fine.
All that said, I cannot however get the bluetooth_tracker.update service call to do a manual update either from within an automation or from the developer tools directly.