Need help figuring out why the bluetooth is not working in the docker container install

Hello

So i am trying the container version (i have no choice for now) and whilst the bluetooth works fine on the host device, it shows up in the container (i think i passed the dbus correctly) /run/dbus:/run/dbus:ro

but it will not scan or recognize any device in Home Assistant

error message:

Local Bluetooth adapters that do not support passive scanning cannot be configured.

but the bluetooth does support passive scanning on the host



Appreciate any assistance

Post the complete docker compose or command-line configuration?

services:
homeassistant:
image: “ghcr. io/home-assistant/home-assistant:stable”
container_name: homeassistant
environment:
- DBUS_SYSTEM_BUS_ADDRESS=unix:path=/var/run/dbus/system_bus_socket
devices:
- /dev/video0:/dev/video0
- /dev/video1:/dev/video1
- /dev/ttyUSB1:/dev/ttyUSB1
- /dev/ttyUSB0:/dev/ttyUSB0
- /dev/bus/usb:/dev/bus/usb
network_mode: host
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- /home/ashipa/ha/config:/config
- /home/ashipa/ha/Data:/mnt/Data
- /home/ashipa:/home/ashipa
- /run/dbus:/run/dbus:ro
restart: unless-stopped
privileged: true

Did you see this thread?

Thank you.

i have gone through that thread and i don’t see anything that matches my experience.

i don’t have UID/GID mapped in the compose so the marked solution does not appear relevant?

I’d love to help more but I don’t have a BT adapter handy to test this.
Are you sure though that this adapter that you have does support passive scanning?

its the onboard bluetooth on a laptop, and it definitely does support passive scanning.

on the host:

`$ bluetoothctl --version
bluetoothctl: 5.79

ashipa@vm:~$ bluetoothctl

[bluetooth]# Agent registered
[bluetooth]# hci0 new_settings: powered bondable ssp br/edr le secure-conn
[bluetooth]# [CHG] Controller 74:C6:3B:41:0B:6A Pairable: yes
[bluetooth]# [CHG] Controller 74:C6:3B:41:0B:6A Discovering: no
[bluetooth]# [CHG] Controller 74:C6:3B:41:0B:6A Discovering: yes
[bluetooth]# [NEW] Device 25:37:03:22:CD:3A 25-37-03-22-CD-3A
[bluetooth]# [NEW] Device 3E:30:C6:FC:8C:61 3E-30-C6-FC-8C-61
[bluetooth]# [NEW] Device A4:C1:37:51:31:99 135-Bank
[bluetooth]# [NEW] Device A5:C2:37:04:11:B1 300Ah
[bluetooth]# [NEW] Device B4:E6:2A:26:8F:9C B4-E6-2A-26-8F-9C
[bluetooth]# [NEW] Device 1A:7A:E9:FA:C1:61 1A-7A-E9-FA-C1-61
[bluetooth]# [NEW] Device 27:C6:8D:99:BB:73 27-C6-8D-99-BB-73
[bluetooth]# [NEW] Device 5D:72:52:C5:28:B3 5D-72-52-C5-28-B3
[bluetooth]# [CHG] Device A4:C1:37:51:31:99 RSSI: 0xffffffd0 (-48)
[bluetooth]# [CHG] Device 3E:30:C6:FC:8C:61 RSSI: 0xffffffbc (-68)
[bluetooth]# [CHG] Device 25:37:03:22:CD:3A RSSI: 0xffffffb4 (-76)
[bluetooth]# [CHG] Device A5:C2:37:04:11:B1 RSSI: 0xffffffca (-54)
[bluetooth]# [CHG] Device B4:E6:2A:26:8F:9C RSSI: 0xffffffa0 (-96)`

if it helps this is the diagnostics log from the bluetooth in the container itself:

even weirder, i ran it inside the container, and it took almost a minute to get going

but it does appear to be working:

$ docker exec -it homeassistant /bin/bash
vm:/config# bluetoothctl
[bluetooth]# hci0 new_settings: powered bondable ssp br/edr le secure-conn
[bluetooth]# Agent registered
[bluetooth]# [CHG] Controller 74:C6:3B:41:0B:6A Pairable: yes
[bluetooth]# hci0 type 6 discovering off
[bluetooth]# [CHG] Controller 74:C6:3B:41:0B:6A Discovering: no
[bluetooth]# hci0 type 6 discovering on
[bluetooth]# [CHG] Controller 74:C6:3B:41:0B:6A Discovering: yes
[bluetooth]# [NEW] Device A4:C1:37:51:31:99 135-Bank
[bluetooth]# [NEW] Device 01:61:9D:0E:9D:92 01-61-9D-0E-9D-92
[bluetooth]# [NEW] Device B4:E6:2A:26:8F:9C LG SJ5(9C)
[bluetooth]# [NEW] Device A5:C2:37:04:11:B1 300Ah
[bluetooth]# [NEW] Device C4:61:B6:E0:A2:D2 Mi Smart Band 4
[bluetooth]# [NEW] Device 1E:F8:0D:17:7A:E3 1E-F8-0D-17-7A-E3
[bluetooth]# [NEW] Device 10:37:E3:36:9A:DA 10-37-E3-36-9A-DA
[bluetooth]# [DEL] Device A4:C1:37:51:31:99 135-Bank
[bluetooth]# [DEL] Device 01:61:9D:0E:9D:92 01-61-9D-0E-9D-92
[bluetooth]# [DEL] Device B4:E6:2A:26:8F:9C LG SJ5(9C)
[bluetooth]# [DEL] Device A5:C2:37:04:11:B1 300Ah
[bluetooth]# [DEL] Device C4:61:B6:E0:A2:D2 Mi Smart Band 4
[bluetooth]# [DEL] Device 1E:F8:0D:17:7A:E3 1E-F8-0D-17-7A-E3
[bluetooth]# [DEL] Device 10:37:E3:36:9A:DA 10-37-E3-36-9A-DA

i’m very confused now

tried a lot of stuff.

eventually ended up trying to get into the container and installing (reinstalling bluez )

finally added these lines to configuration.yaml:

bluetooth:
discovery: true
passive: true
match_all: true # Discovers all BLE devices
interval_seconds: 1 # How often to scan
scan_filter: "all" # Include all devices in scanning

and restarted the container. et voila. It is now working


1 Like