Docker compose and bluetooth

Hi,
I’m struggling regarding usage of bluetooth in Docker-compose.
First: I have Home assistant working nicely as well as traeffik for external access to it.

Then i wanted to install my Asus bluetooth dongle on the Pi. It worked. I looked around to see if can have access to bluetooth through docker compose for HA to have a presence detection… And the results i found was to use network-mode: Host on the compose file for HA.

But now, i can’t have access to HA when i’m not in the same network…

Do you know if there is a solution for mapping bluetooth through the container and disable network-mode host as i want to have access through traefik to my instance ?

Thanks

I have the same problem.
I’m looking for a solution which can use the Bluetooth on a bridge driver.

Any ideas?
Thanks in advance

Solution I think :slight_smile:

I tried this solution, and indeed, it works perfectly.

The thing is that in network mode: Host, traefik doesn’t see the Home assistant docker anymore.

One solution that i have tried is to create a python script and update via mqtt a presence sensor. It worked smoothly, but i want to know if it is not better to create the same python script and run it inside a docker container.

Barique,

you have to make some changes to your traefik.toml to help Traefik find your host internal and to be able to expose it to Traefik

Change http://192.xxx.xxx.xxx:8123 to the IP of your Docker machine
Change Host:your.domain.com to your own domain

Thats it, thanks to @piotr who learned me …

Solution #2

 [file]
 [backends]
   [backends.backend-homeassistant]
     [backends.backend-homeassistant.servers]
       [backends.backend-homeassistant.servers.server-homeassistant-ext]
         url = "http://192.xxx.xxx.xxx:8123"
         weight = 0

 [frontends]
   [frontends.frontend-homeassistant]
     backend = "backend-homeassistant"
     passHostHeader = true
     [frontends.frontend-homeassistant.routes]
       [frontends.frontend-homeassistant.routes.route-homeassistant-ext]
       rule = "Host:your.domain.com"

Thanks a lot, i’ve been reading traefik configuration a lot lately…
With Traefik V2 it seems to be different. https://github.com/htpcBeginner/docker-traefik/blob/53288faa9118fdc911da291b3889426c01c5537f/traefik2/rules/app-hassio.toml.example

The fact is that Ble component on Hass.io is not very effective and i have one time or another a problem with the ble component which cause Home assistant to put me “not_home” even if i’m still at home…

Nevertheless, i am now capable of accessing Hass.io through traefik in a docker container