How to add zigbee usb controller to OH docker, via portainer

my ubuntu 16 is currently hosting OH, mqtt, portainer dockers. OH currently has a Z wave usb controller (/dev/ttyACM0)and I wish to add a zigbee controller(/dev/ttyUSB0) to it as well.
Is it possible to do so without stopping the OH container? If so, how can it be done?
If I have to stop the container, what is the commands I need to input inside portainer for this OH container?

much thanks

I don’t know portainer but I do know you have to recreate the container to added a new device.

Again, I don’t know anything about portainer, but with Docker you pass through the hardware on the docker run command or in the docker-compose file.

None of this is OH related. You might find better support on a portainer forum.

Thanks Rich.
I destroyed the OH container, and added the --device=/dev/ttyUSB0 . But after creating it again, in paper UI and also in Habamin, only the port of /dev/ttyACM0 ( which is for my z wave Aeotec Gen5 stick) was available when I tried to configure its port.
the Z wave stick on port ACM0 seems to be fine.

You may need to pass in an environment variable to add the device to the command line.

EXTRA_JAVA_OPTS is the variable. See https://www.openhab.org/docs/installation/linux.html#privileges-for-common-peripherals.

Thanks Rich. How come I did not need to do that for my z wave aeotec gen 5 stick?
This is my docker command:

docker run \
  --name openhab \
  --net=host \
  --restart=always \
  --device=/dev/ttyACM0 \
  --device=/dev/ttyUSB0 \
  -v /etc/localtime:/etc/localtime:ro \
  -v /etc/timezone:/etc/timezone:ro \
  -v /opt/openhab/addons:/openhab/addons \
  -v /opt/openhab/conf:/openhab/conf \
  -v /opt/openhab/userdata:/openhab/userdata \
  -e "EXTRA_JAVA_OPTS=-Duser.timezone=Asia/Singapore" \
  openhab/openhab:2.5.0.M1-amd64-debian

Do I just add another line like this?

-e "EXTRA_JAVA_OPTS=-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:dev/ttyACM0"

I don’t know. I haven’t had to do it for on my controller/coordinator. But the drive are clear that this might beer necessary. Given that in your car one is a ttyACM and there either is a ttyUSB could be relevant.

Don’t added another
EXTRA_JAVA_OPTS. You’ve already got one being passed into the container. If you added another -e you will overwrite the first one.

Just add to the one that is already there. Add a space and then the -D option to the -e EXTRA_JAVA_OPTS that’s already there.

“Just add to the one that is already there. Add a space and then the -D option to the -e EXTRA_JAVA_OPTS that’s already there.”

Sorry, What exactly do you mean by that? is this what you are suggesting?

-e "EXTRA_JAVA_OPTS=-Duser.timezone=Asia/Singapore -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:dev/ttyACM0 " \

Yes, that.

I did the changes for “EXTRA_JAVA_OPTS”, deleted, and recreated the container. Still no difference.
Paper UI and Habamin finds the zigbee controller (it even lists it with the correct port eg /dev/ttyUSB0) , but when I add it as a thing, it only shows the /dev/ttyACM0 option - which belongs to my z wave stick

I use Ansible to manage my containers so I don’t actually know exactly what my command line looks like, but I notice that I’m actually mapping the device and providing permissions.

    devices:
      - "/dev/ttyUSB0:/dev/ttyUSB0:rwm"
      - "/dev/ttyUSB1:/dev/ttyUSB1:rwm"

Hi Rich,
Thanks.
Can I add the same “…:rwm” at the end of my “EXTRA_JAVA_OPTS”? would that work?

As my zigbee controller is actually on an SEH myutn250 serial port server, and not on the ubuntu VM itself, would it matter if the “owner” of the usb device is root, instead of openhab?

No. The EXTRA_JAVA_OPTS is passed to the command that starts OH inside the container. The :rwm is a flag to Docker or portainer telling it what permissions the stuff running inside the container has for that device.

It matters if the openhab users does not have permission to read and write to that device file. Typically there will be a different group from root (e.g. dialout or tty) that you can add the openhab user to that will give it permission to access the device. If not then you need to run OH as root or figure out how to otherwise permanently give openHAB permission on that device.

The rwm option does not override the permissions on the file on the host. You can only make access more restricted inside the container, not less restricted.