Give access to Bluetooth with Macvlan


I am new to this forum and not sure if it is the correct category to ask for help.

I am hosting an Home Assistant instance in Docker on an Hardkernel Odroid N2+ running Debian with a Bluetooth dongle. I want to give HA Bluetooth access for this addon : GitHub - custom-components/ble_monitor: BLE monitor for passive BLE sensors , an addon that allows to scan for nearby BLE devices.

My container is deployed in docker compose the following way:

    platform: "linux/arm64"
    container_name: homeassistant
    restart: unless-stopped
      - services
      - macvlan
      - PUID=0
      - PGID=0
      - TZ=${TZ}
      - ${CONFIG_FOLDER}/homeassistant:/config
      - /run/dbus:/run/dbus:ro

The addon recommends to use network mode host for the container. That works and allows the addon to find the Bluetooth interface in the host.

But I prefer other network modes as I want to be able to join bridge docker networks. So I began using macvlan network mode. That is great for DLNA music playback for example, and still allows to join bridge network.

But with Macvlan, my containers can’t see the Bluetooth interface (called hci0). The network modes other than bridge and host are not very documented over the internet so I have a hard time trying to inderstand how they work exactly.

This is a difficult problem because it calls to very different knowledges (both how Docker network works, how Bluetooth works on the host, and how the HA addon works). So I am looking to understand one bit at a time.

On Docker, what network mode works the best to give access to the host’s Bluetooth interface ?

Thanks in advance for any answer on this problem, I am available for more details (I’m not sure what would be required) if needed.

1 Like