[Solved] USB Bluetooth support on Synology DSM 7.1 and DSM 7.2

I am using Container Manager (dsm 7.2) for managing docker containers including HA. This is the image:

And the bluetooth tools are available inside the container:
image

bluetoothctl cannot be used, I don’t think the HA container has the D-Bus available for the bluez service.

Hi kcsoft, thanks for the reply.

Yeah the hciconfig and hcitools commands seem to work fine for me:

homeassistant:/config# hciconfig
hci1:   Type: Primary  Bus: USB
        BD Address: 00:19:86:00:0B:79  ACL MTU: 1017:8  SCO MTU: 64:0
        UP RUNNING
        RX bytes:1408 acl:0 sco:0 events:52 errors:0
        TX bytes:413 acl:0 sco:0 commands:40 errors:0

hci0:   Type: Primary  Bus: USB
        BD Address: 00:1A:7D:02:16:A3  ACL MTU: 1021:6  SCO MTU: 255:12
        UP RUNNING
        RX bytes:454729 acl:0 sco:0 events:22288 errors:0
        TX bytes:156533 acl:0 sco:0 commands:22288 errors:0

homeassistant:/config# hcitool scan
Scanning ...
        00:04:4B:5B:C1:A2       nVidia SHIELD

But when I go into my home assistant integrations, bluetooth keeps showing an error.


I wonder if my issue has to do with me using “Home Assistant Supervisor”, you seem to be using the standard version

I have the same error in the BT config in the UI.
I am using “Passive BLE Monitor integration” with a few ble devices.

I’ve got Passive BLE Monitor also, but I don’t really know how to use it. It doesn’t seem to pick up anything.
Basically all I want to do is connect my Home Assistant to a single Switchbot Bot

I’ve tried manually adding the MAC address of the SwitchBot device in my config yaml file… like this:

ble_monitor:
  bt_interface:
    - '00:19:86:00:0B:79'
    - '00:1A:7D:02:16:A3'
  devices:
    - mac: 'D0:98:64:99:05:6B'

But it doesn’t seem to pick up anything… (again… I’m not really sure if I’m using it correctly)

So I ended up just backing up my home assistant settings, removing the docker version and installing HA via VM, then restoring the backup. Bluetooth worked straight away and immediately found my SwitchBot device.
Super easy to setup. I don’t know why I didn’t just do this to begin with. I guess I was worried it was going to be a big task transitioning from Docker to VM, but it was super simple. Surprisingly, I didn’t run into a single issue!
Problem solved for me :slight_smile:

Thank you very much for the guideline, maybe my platform is too small potato. it is RTD1296 of DS218
For the container manager, I can run now and install the Ubuntu 2204, but when in the step of EnvDeploy, there is error showing that the chroot for Exec format error, and if I use my x86 to do the compile, the arch will be x86 and can’t find the aarch64 gcc in which I already installed
may I know if you are going to share cross platform’s experience so that we can try on it? as Bluetooth is quite important but DSM 7.0 already delete the support about it.

Thanks ,when i run:“hciconfig hci0 up” in homeassistant container, an erro :“Can’t init device hci0: Operation not permitted (1)”,how to dail with it?

If you use a synology with VM to run home assistant you don’t need all that “hokus-pokus” described above this contribution.
Although DSM 7.X is no longer available for USB devices, the pass-through still works. That means you really can have a bluetooth dongle working in home assistant within a minute.

Here are the steps:

  • Plug your dongle into the synology.
  • Go to your VM machine and choose in the column on the left side: ‘Virtual machine’
  • In the upper bar choose: ‘Action’
  • Within action choose : ‘Edit’
  • In the popup screen choose the tab: ‘Other’.
  • Then scroll all the way down and find ‘USB-device’.
  • Click on the ‘+’ sign next to it and select the dongle you just inserted.
  • Press OK

Probably before you return to Home Assistant it will say here that a new device has been detected. Configure it and probably new devices will be detected right away.

2 Likes

Thank you! Was wasting the entire day trying to get past those errors! Once I installed Virtual Machine Manager, and configured Home Assistant as VM w/ passthrough USB device as you described above, everything works as expected. Thank you! Saved me a ton of time!

Needs --Privileged / added to the docker start script… then you’ll be able to run those hciconfig commands, but you’ll still get additional errors. Only way that seems to work is through VMM.

1 Like

Compiled for cedarview (1513+) DSM7.1

https://drive.google.com/drive/folders/1hoLc5yefBk4Q9ts_bwKq7s4g6G6YYsCm?usp=sharing

Hello!

I tried to compile the bluetooth driver for Linux 4.4.302+ aarch64 GNU/Linux synology_rtd1296_ds218play but failed miserably? Maybe someone else has this driver and might want to share them would be greatly appreciated :wink:

https://drive.google.com/drive/folders/14KPDiymwuX2lXHuoVqkG7jNmVveEN_m9?usp=sharing
take a try, I was stopped at the python, python didn’t included with bluetooth.
it is 4.4.302+ aarch64 GNU/Linux synology_rtd1296

1 Like

Do you have any recommendation for an adapter working with the VM directly? What adapter are you using?
Thank you @DN38416 @Snuf1

Can someone compile Bluetooth modules for Armada375 architecture?
I followed guide down below, but couldn’t finish because of compilation errors in step 4 (make command). I tried changing EnvDeploy version to 7.0 but I get same result.

Other info if needed:

Thanks in advance!

since reloading Synology OS 7.2 from fresh I have to manually run this command from SSH on the NAS not the container (well I do that too via the Home Assistant script (see above)).

hciconfig hci0 up

without it the Synology NAS says hciconfig is down

Any pointers to what is wrong?

I believe this is because I hack onto the synology OPKG and blues before I found out that synology does not do b-bus.

fixed by removing opgk and removing bluez

Can someone recommend the best Bluetooth dongle to purchase? I have the 1520+

I get all the code in the terminal to find the drivers. I just want to make sure I get a dongle that’s actually gonna work first just the best one you guys opinion or will all of them work?

Thanks

@image969:

I use SABRENT BT-UB40 (CSR chipset CSR8510A10) on DSM7.2 (DS920+ , geminilake) successfully.

There is an interesting link to various BT adapters here:

I would imagine the previous list of DSM6.x compatible USB adapters would also work : ?
https://www.synology.com/en-uk/compatibility?search_by=category&category=usb_bluetooth_dongles

The only aspect you mind want to consider is whether the range provided by those btdongle will suffice given their small antenna design nature or if you want an external antenna.

Saying that, I come to revisit this thread aftrer around 1 year after noticing that the bluetooth.ko and btusb.ko had somehow disappeared from /lib/modules/ and Homeassistant docker container was error’ing with “hciconfig hci0 up” error.

I coppied once more those files with 644 permissions and tried to execute the “start-bluetooth” (aka insmod script) - No errors but at the same time the modules are no loaded ? and hciconfig still fails

The DS920 GUI still shows the dongle detected but for a reason or another things behave differently to how they did about 1 years ago.

Currently running DSM 7.2.1-69057 Update 3


UPDATE:
The dmesg output might be telling me that those bluetooth modules might need to be recompiled for the the Linux 4.4.302 ?

I am using a DS920+ (gemini lake) , anyone with this already compiled for the 4.4.302 ?


root@DiskStation:/dev# ls -la | grep hci
root@DiskStation:/dev# sudo /usr/local/etc/rc.d/start-bluetooth-modules.sh start
root@DiskStation:/dev# dmesg | grep bluetooth
[75141.942304] bluetooth: version magic '4.4.180+ SMP mod_unload ' should be '4.4.302+ SMP mod_unload '
root@DiskStation:/dev# dmesg | grep bt
[75141.964161] btusb: version magic '4.4.180+ SMP mod_unload ' should be '4.4.302+ SMP mod_unload '
root@DiskStation:/dev# ls -la /lib/modules | grep bluetooth
-rw-r--r--  1 root root 6952800 Apr  4 22:05 bluetooth.ko
root@DiskStation:/dev# ls -la /lib/modules | grep btusb
-rw-r--r--  1 root root  588904 Apr  4 22:05 btusb.ko
root@DiskStation:/dev# lsmod | grep bt
btrfs                1283822  4 nfsd
raid6_pq               97268  4 async_pq,raid456,btrfs,async_raid6_recov
xor                    10808  2 btrfs,async_xor
zstd_compress         154833  1 btrfs
zstd_decompress        60974  1 btrfs
ecryptfs               85159  1 btrfs
root@DiskStation:/dev#

UPDATE: I realised that those geminilake / 4.4.302 had already provided by @kcsoft back on the 1st Sept 2023 -

I guess that I must have updated my DSM release since March 2023 and never realised the issue.

After using the compiled modules, all is working well again.

root@DiskStation:/lib/modules# lsmod | grep bt
btusb                  27178  0
bluetooth             278277  2 btusb
btrfs                1283822  4 nfsd
raid6_pq               97268  4 async_pq,raid456,btrfs,async_raid6_recov
xor                    10808  2 btrfs,async_xor
zstd_compress         154833  1 btrfs
zstd_decompress        60974  1 btrfs
ecryptfs               85159  1 btrfs
usbcore               209065  22 uas,ch341,btusb,etxhci_hcd,r8152,usblp,uhci_hcd,usb_storage,cp210x,usbserial,ti_usb_3410_5052,ehci_hcd,ehci_pci,pl2303,usbhid,ftdi_sio,cdc_acm,xhci_hcd,xhci_pci
root@DiskStation:/lib/modules# lsmod | grep bluietooth
root@DiskStation:/lib/modules# lsmod | grep bluetooth
bluetooth             278277  2 btusb
root@DiskStation:/lib/modules# hciconfig hci0 up

THanks @kcsoft

Thank you for making this possible. I am new to setting this up on a Synology DSM 7.2. I followed all your steps from the guide, but got stuck on copying the bluetooth kernel modules to the Synology NAS /lib/modules. how can I find the 2 files and copy to the NAS. I tried the ‘sudo cp’ command in root of NAS and I get ‘No such file or directory’ Thanks for any reply about this.