Docker & BluetoothBridge

Tags: #<Tag:0x00007f617052f700> #<Tag:0x00007f617052f598>

Hi,

I have set up the docker container “openhab/openhab:latest-debian” on my openSuSE 15.1. I already integrated an MQTT-bridge, which is working for the best. Now I wanted to integrate an bluetooth-dongle.
My suse host can handle it:

robotron:~ # lsusb

Bus 003 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

robotron:~ # hcitool dev
Devices:
hci0 00:1A:7D:DA:71:08
robotron:~ #

But inside the container I cannot configure it. I installed the “Bluetooth Binding”, went to “Inbox” -> “Bluetooth Binding” -> “Add manually” > “Bluetooth blueZ Adapter” and added the address, I got from the host system.

Finaly the the dongle is not working in state: “UNINITIALIZED - HANDLER_INITIALIZING_ERROR”.
Since there are not any bluetooth tool inside the container, I’m asking whether it is possible to get this running inside a container?

Any help welcome

This is a Docker / openSuSE / Bluetooth question unrelated to OpenHAB.

Did you pass the device to the container in the docker run command? Is the user inside the container (openhab, 9001 by default I think but you can set it using a passed in environment variable) a member of what ever group has permissions to read/write to that device (on debian Linux variants that group is usually dialout or tty)?

I passed to the container with:
–net=macvlan-weiss --ip=192.168.120.150
–privileged
–cap-add=SYS_ADMIN
–cap-add=NET_ADMIN \

Inside openhab’s uid =
root@0a39aa0e9e32:/openhab# id openhab
uid=454(openhab) gid=455(openhab) groups=455(openhab),10(uucp),20(dialout),14(uucp2),16(dialout2),18(dialout3),32(uucp3),997(gpio)
root@0a39aa0e9e32:/openhab#

In the host, I added openhab to the groups:
robotron:~ # grep openhab /etc/group
tty:x:5:openhab
dialout:x:16:lirc,openhab
openhab:x:455:falk,openhab
robotron:~ #

But the error remains. Below /dev I can’t find a device node for that, but do bluetooth devs have one?

uid=454(openhab) gid=455(openhab) groups=455(openhab),10(uucp),20(dialout),14(uucp2),16(dialout2),18(dialout3),32(uucp3),997(gpio)
root@0a39aa0e9e32:/openhab#

I don’t see an option to pass the device into the container. See the docs for the --device option to docker run

I tried on VM, but also without success. In fact I found this:
[https://github.com/openhab/openhab2-addons/pull/5706]
a bug, fixed in 2.5

I don’t use the BT binding so I’ll be of limited help. But if that bug fix is the source of a problem, you need to run OH 2.5 M4 (or any version of OH after June of this year).