How to mount a specific host folder into an add-on?

Hello, I’ve built a docker container which uses some bluetooth capabilities.
In order to make sure everything is working fine, I’ve tried in my docker container to run bluetoothctl paired-devices and made sure it gave me the same list as I’ve got on my host.
It works perfectly. In order to get that though, I need to pass the following parameters when doing docker run: --privileged -v /var/run/dbus:/var/run/dbus
If I remove one or the other argument, it doesn’t work anymore.

I’ve built a tiny add-on config where I’m trying to have all this wrapped into a HA add-on. Unfortunately, I always get

dbus[9]: arguments to dbus_connection_get_object_path_data() were incorrect, assertion "connection != NULL" failed in file ../../../dbus/dbus-connection.c line 5905.
This is normally a bug in some application using the D-Bus library.
  D-Bus not built with -rdynamic so unable to print a backtrace
/run.sh: line 11:     9 Aborted                 (core dumped) bluetoothctl paired-devices

Meaning… some param wasn’t passed correctly. Here’s my HA add-on config:

name: "..."
description: "..."
version: "..."
slug: "..."
arch:
  - aarch64
  - amd64
  - armhf
  - armv7
  - i386
startup: "services"
boot: "auto"
services:
  - mqtt:need
options:
  mqttsPort: 8883
schema:
  mqttsPort: port
privileged:
  - NET_ADMIN
  - SYS_ADMIN
  - SYS_RAWIO
  - SYS_TIME
  - SYS_NICE
  - SYS_RESOURCE
  - SYS_PTRACE
  - SYS_MODULE
  - DAC_READ_SEARCH
full_access: true
host_network: true
host_dbus: true
usb: true
devices:
  - /var/run/dbus

Any idea how I can make sure to have the equivalent of --privileged -v /var/run/dbus:/var/run/dbus?

Thanks!

PS: (just to clarify, but I’ve ofc looked at Add-On Configuration | Home Assistant Developer Docs many times and I still haven’t found what I need)

2 Likes

Doesn’t the “args” option solve your problem? Or could you solve it some other way?