TLDR:
I managed to compile the bluetooth kernel modules (bluetooth.ko and btusb.ko) for Synology DSM 7.1 kernel 4.4.180+, geminilake (x86_64). Models like DS220+, 720, 920.
I am using a Sena UD100 usb bluetooth adapter with my docker installation of Home Assistant and that is working fine. The container is running in privileged mode.
You can verify that in the docker container: docker exec -it homeassistant /bin/sh
then in the container
I will try to find some spare time to document this so others can build for different architectures or for DSM 7.2 that is currently in beta.
The main purpose of this is to allow you to run HA in docker on Synology NAS and having access to a usb bluetooth dongle.
Note:
I have noticed that after reboot, the nas is not bringing the bluetooth interface up.
Also the ble_monitor component can’t do it, maybe related to setcap. [custom_components.ble_monitor] HCIdump thread: Something wrong - interface hci0 not ready
So you might need to do this from HA docker: hciconfig hci0 up
You can do this automatically from HA by creating a shell command and running that command as an automation on HA startup.
Thanks for working on this. So I tired this on my RS818 (Avoton) and I get an error loading, going to assume because these were not compiled for this particular platform. Any way to compile for that?
insmod: ERROR: could not insert module /lib/modules/bluetooth.ko: Invalid module format
insmod: ERROR: could not insert module /lib/modules/btusb.ko: Invalid module format
Sweet thanks. So my system took them and looks like I can configure them. Changes HA to —privileged and hciconfig hci0 up but seems like HA still can’t find any adapters:
No unconfigured Bluetooth adapters found. There are 0 ignored adapters.
I’ll have play with this more later.
Update: So I did mess with this more and unfortunately didn’t get anywhere;
And then inside the container I am able to start up hci0 but HA can’t find any of my BT adapters. I ran in privileged and also volume mounted /var/run/dbus.../run/dbus, etc.
@oam Probably not. Whenever I’ll have some free time I will try to put together a guide on how to compile the modules for different platforms or to compile for this platform.
I set this up and it looks like it found my adapter, but nothing identified yet. I am assuming this is limited to just sensors and can’t actually control anything (like a lock, etc.). Pretty cool I guess bluetooth is sorta working again native with docker HA, but still would need the full solution.
DS620slim (apollolake), DSM 7.1.1. BT Dongle can be seen as connected USB device in control panel. Was able to insmod provided modules for geminilake without errors (lsmod shows them in use) and bring hci interface up in docker container. But nothing happens after that. RT/TX counter doesn’t increase at all. Errors counter stays at 0. HA doesn’t see any BT devices, neither I able to add “bluetooth” integration, not any btle devices announcements shows up (I know they are broadcasting, because when I’ve tried esphome’s bluetooth proxy feature before, HA identified and suggested to add some of btle devices around). HA container running high privilege.
But I’m guessing, maybe DSM missing some BT packets, like bluez/dbus mentioned in BT integration guide? Haven’t come around guides how to add them to DSM.
Would be grateful for any solution or guidance to this problem. Not wiling to move from docker to VM because of this.
I use dsm 7.1 x86 ds920, the configuration is the same as yours, I follow your operation all the way until hciconfig hci0. It prompts me that command not found. My ha is installed through vmm.
@makiyd6 If you are using vmm, you don’t need the bluetooth kernel modules.
For virtual machine, you can install any guest os and either it already supports bluetooth or you can load the bluetooth modules. The host os (synology) provides the generic usb device and the guest os takes care of supporting it as bluetooth.
This thread is about supporting usb+bluetooth in docker on Synology DSM 7.1.
Up to Synology DSM 6, the usb drivers were included in the kernel but then on 7+ Synology decided to remove usb support as I imagine it isn’t easy to provide technical support for different usb devices.
So for docker there is no guest os, instead docker uses the host os kernel. So to have usb support in the docker container, you need to have usb (usb+bluetooth) support in the host that is Synology DSM.
Also please note that the hciconfig command was executed inside the docker container:
ssh into you synology, then execute on the synology: sudo docker exec -it myHA sh (replace myHA with the name of your HA container). This will run the shell from the docker container where you can run the hciconfig
Can control (limited control supported by integration) the Govee Bluetooth-only light strip through Sabrent dongle within HA
When trying to add a second Govee Bluetooth integration, it shows that HA can now see all of the other advertising devices through the BT dongle , which tells me all is working great
Thank you for your drivers !
I have created a guide on how to compile the kernel modules here:
In this thread I have uploaded the compiled modules for geminilake and avoton, if anyone compiles them for other architectures, it would be nice to share.