Bluetooth presence on hass.io running in docker on Ubuntu

Hi,

I’m running hass.io in docker on my Ubuntu server. I migrated from a Pi 4. I recently spotted that my bluetooth config was complaining in the logs. Today I added a bluetooth adapter to the server (it works and I can scan from the base OS), but I don’t understand how to make it visible within Hass.io to allow BLE presence. The terminal/ssh add-on gives me a limited shell into the docker container, and doesn’t allow me to do anything bluetooth related. How do I ensure the docker image has access ?

A little late, but for others searching, its simple - you map the device in the container using devices:
on a pi bluetooth is /dev/ttyAMA0

So a docker-compose.yml might look something like below

  homeassistant:
    image: homeassistant/home-assistant:stable
    container_name: homeassistant
    restart: always
    volumes:
      - /opt/homeassistant:/config
    environment: 
      - TZ=Africa/Pretoria
    network_mode: host 
    devices:
      - /dev/ttyAMA0:/dev/ttyAMA0

I dont know why my docker wont accept my ble bluetooth stick.

My host is openmediavault system. debian based. uname -a:

Linux omv 5.10.0-0.bpo.12-amd64 #1 SMP Debian 5.10.103-1~bpo10+1 (2022-03-08) x86_64 GNU/Linux

lsusb on host gives me:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

on docker:

bash-5.1# lsusb
Bus 001 Device 003: ID 10c4:ea60
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0003
Bus 001 Device 002: ID 0a12:0001

I changed my docker-compose homeassistant part to network_mode host and privileged true. Just to that it works. But it does not.
When exec into my homeassistant docker and run this:

bash-5.1# bluez-simple-agent 
Traceback (most recent call last):
  File "/usr/bin/bluez-simple-agent", line 8, in <module>
    import dbus
ModuleNotFoundError: No module named 'dbus'

or this:

bash-5.1# bluetoothctl 
Waiting to connect to bluetoothd...dbus[298]: arguments to dbus_connection_get_object_path_data() were incorrect, assertion "connection != NULL" failed in file dbus-connection.c line 5905.
This is normally a bug in some application using the D-Bus library.

  D-Bus not compiled with backtrace support so unable to print a backtrace
Aborted (core dumped)

My compose looks like this:

  homeassistant:
    image: ghcr.io/home-assistant/home-assistant:stable
    container_name: homeassistant
    network_mode: host
    volumes:
      - ./configs/homeassistant/:/config
      - /etc/localtime:/etc/localtime:ro
    environment:
      - TZ=Europe/Paris
#    ports:
#      - 7001:8123
    privileged: true
    restart: unless-stopped

Is any config wrong?