RPi 3B+ bluetooth not working

The latest version of DietPi v9.6.1 is running on RPi 3B+ and I’m trying to connect some BT thermometers to integrate them in HA. Thermometers are visible from other devices like smartphones, but HA doesn’t find them. Also, RPi’s not visible for any device, so I assume the problem is in its BT connection. I’ve turned on Bluetooth from dietpi-config and I see it running:

root@DietPi:~# systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2024-07-10 16:54:12 CEST; 6h ago
       Docs: man:bluetoothd(8)
   Main PID: 824 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 1069)
        CPU: 149ms
     CGroup: /system.slice/bluetooth.service
             └─824 /usr/libexec/bluetooth/bluetoothd --noplugin=sap

Jul 10 16:54:12 DietPi systemd[1]: Starting Bluetooth service...
Jul 10 16:54:12 DietPi bluetoothd[824]: Bluetooth daemon 5.55
Jul 10 16:54:12 DietPi systemd[1]: Started Bluetooth service.
Jul 10 16:54:12 DietPi bluetoothd[824]: Starting SDP server
Jul 10 16:54:12 DietPi bluetoothd[824]: Excluding (cli) sap
Jul 10 16:54:13 DietPi bluetoothd[824]: Bluetooth management interface 1.22 initialized
Jul 10 16:54:13 DietPi bluetoothd[824]: Failed to set privacy: Rejected (0x0b)

I’ve added --noplugin=sap, because I found it as a potential solution by @Jappe (thanks), but unfortunately, it didn’t work in my case. Some addition info:

root@DietPi:~# bluetoothctl
Agent registered
[CHG] Controller B8:xx:xx:xx:xx:27 Pairable: yes
root@DietPi:~# journalctl -u bluetooth -u hciuart
-- Journal begins at Wed 2024-07-10 16:54:00 CEST, ends at Wed 2024-07-10 23:02:10 CEST. --
Jul 10 16:54:04 DietPi systemd[1]: Starting Configure Bluetooth Modems connected by UART...
Jul 10 16:54:12 DietPi btuart[458]: bcm43xx_init
Jul 10 16:54:12 DietPi btuart[458]: Flash firmware /lib/firmware/brcm/BCM4345C0.raspberrypi,3-model-b-plus.hcd
Jul 10 16:54:12 DietPi btuart[458]: Set BDADDR UART: b8:xx:xx:xx:xx:27
Jul 10 16:54:12 DietPi btuart[458]: Set Controller UART speed to 3000000 bit/s
Jul 10 16:54:12 DietPi btuart[458]: Device setup complete
Jul 10 16:54:12 DietPi systemd[1]: Started Configure Bluetooth Modems connected by UART.
Jul 10 16:54:12 DietPi systemd[1]: Starting Bluetooth service...
Jul 10 16:54:12 DietPi bluetoothd[824]: Bluetooth daemon 5.55
Jul 10 16:54:12 DietPi systemd[1]: Started Bluetooth service.
Jul 10 16:54:12 DietPi bluetoothd[824]: Starting SDP server
Jul 10 16:54:12 DietPi bluetoothd[824]: Excluding (cli) sap
Jul 10 16:54:13 DietPi bluetoothd[824]: Bluetooth management interface 1.22 initialized
Jul 10 16:54:13 DietPi bluetoothd[824]: Failed to set privacy: Rejected (0x0b)

Is there any way to fix this issue?

A short update. After multiple tries, I managed to connect to one thermometer, but it won’t pair at all. Basically, it connects to the device, and I can confirm that by doing

info <mac address of a device>

It shows connected: yes. But as soon as I try to pair it with the command below, it disconnects afterwards.

[bluetooth]# pair A4:C1:38:xx:xx:05
Attempting to pair with A4:C1:38:xx:xx:05
[CHG] Device A4:C1:38:xx:xx:05 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device A4:C1:38:xx:xx:05 Connected: no

I watched some youtube videos and noticed after flashing custom firmware and setting advertising type to BTHome (which I also did), for them, it basically works out of the box, they don’t even have to bother with this pairing.

Can someone please provide some suggestion how to potentially solve this issue?

What exactly did you try?

power on
agent on
default-agent
scan on

?
If other devices can not see your RPi you can set

discoverable on
pairable on

Regarding the privacy error you can also have a look into /etc/bluetooth/main.conf and set Privacy = off

There are also ways to use simple pairing:

menu agent
simple-agent on
scan on

Or disable security completely:
main.conf:

[General]
Class = 0x000100
DisableSecurity = true

The video you mentioned, they also use bluetoothd?

1 Like

Thanks for answering, Jappe. I managed to fix it. As I had a problem with adding them to HA, I thought maybe once I add them from cli, it will start working. After numerous different tries, I noticed a problem with adding them to HA was an ignored Bluetooth integration. I have no idea how and why it was ignored, as I didn’t do it myself, but once I removed it from ignored integrations, thermometers appeared almost instantly.

1 Like