I’m trying to migrate my RPi3 Docker OH2.4 installation to a Docker container on my QNAP NAS drive. The problem I found is that QNAP doesn’t have the cdc-acm.ko drivers to support the Aeotek Gen5 ZStick (which I’m using). So, in order to work around that, I’m generally following this tutorial to continue using my RPi solely as a hub for the Zstick, and then forwarding the data via TCP, using ser2net and socat, to the NAS. From there, I figure I should be able to pass the virtual serial port created by socat along to the docker container by adding the docker command line argument “–device=/dev/ttyUSB0”.
So, after setting this all up, when I spin up the container and try to add the ZWave controller through PaperUI, it provides the error “Serial Error: Port {0} does not exist”. This is the problem I’m trying to solve.
So, let’s step back for a second; the first potential point of failure is obviously the Rpi broadcasting the USB data to the NAS drive. Running netstat -ant
from both the Rpi and the NAS indicate that a connection is established between the two:
tcp6 0 0 192.168.0.12:3333 192.168.0.7:59552 ESTABLISHED -
(192.168.0.12 is the Rpi, and 192.168.0.7 is the NAS)
Additionally, when I check /var/log/socat.log on the NAS, I see log entries like this:
2019/07/04 22:37:37 socat[24295] I setting option "symbolic-link" to "/dev/ttyUSB0"
2019/07/04 22:37:37 socat[24295] I setting option "raw"
2019/07/04 22:37:37 socat[24295] I setting option "user" to 0
2019/07/04 22:37:37 socat[24295] I setting option "group" to 0
2019/07/04 22:37:37 socat[24295] I setting option "perm" to 511
2019/07/04 22:37:37 socat[24295] I openpty({6}, {7}, {"/dev/pts/1"},,) -> 0
2019/07/04 22:37:37 socat[24295] N PTY is /dev/pts/1
2019/07/04 22:37:37 socat[24295] N opening connection to AF=2 192.168.0.12:3333
2019/07/04 22:37:37 socat[24295] I starting connect loop
2019/07/04 22:37:37 socat[24295] I socket(2, 1, 6) -> 8
2019/07/04 22:37:37 socat[24295] N successfully connected from local address AF=2 192.168.0.7:59552
2019/07/04 22:37:37 socat[24295] I resolved and opened all sock addresses
2019/07/04 22:37:37 socat[24295] N starting data transfer loop with FDs [6,6] and [8,8]
Also, ll /dev/ttyUSB0
produces this result:
lrwxrwxrwx 1 admin administ 10 Jul 4 22:37 /dev/ttyUSB0 -> /dev/pts/1
So, the serial port (symlink) is there. I don’t really know what I’m doing with socat, but I’m assuming this step is working (huge assumption, I know).
Moving on, the next potential point of failure is passing the virtual serial device to the Docker container. I was doing this before, when I was running OH on a Docker container on my RPi, and it worked fine, so I expect to be able to do it again, here. My full container creation command evaluates to this:
docker run -d --restart always --env-file config.env --device=/dev/ttyUSB0 --net=host openhab/openhab:2.4.0
. I’m able to access the site through the browser, install the zwave binding, and add the serial controller, but when I provide it with “/dev/ttyUSB0” as the serial port, that’s when I get the error message. Quickly checking the container’s filesystem with ll /dev/ttyUSB0
, I get
crwxrwxrwx 1 root root 136, 1 Jul 5 02:52 /dev/ttyUSB0
, so the container’s at least picking it up, but I don’t really know what it’s doing with it beyond that.
Can anyone provide any assistance with this issue, please? If I need to provide any more information, please let me know. Thanks!
- Platform information:
- Hardware: QNAP 231-P2 NAS
- openHAB version: Docker image: openhab/openhab:2.4.0