tdeckers / docker-openhab

Docker image for Openhab
33 stars 41 forks source link

Running on UnRaid with USB support? #11

Open christianwaite opened 9 years ago

christianwaite commented 9 years ago

Hi, sorry if this is the wrong place for discussion. I tried to create my own docker for OpenHAB2 a while ago, but being new to both Docker and OpenHAB I failed miserably (could get the interface to launch, but nothing else). Now I have OpenHAB running in a VM on UnRaid, but does your docker method work with a USB ZWave stick, i.e. it'll mount onto ttyUSB0 etc and can be used in HabMIN?

If so I might move back over to Docker instead of VM. Thanks Christian

NotYetRated commented 9 years ago

Hello, also curious about this. How exactly does one pass a USB device on to a docker even?

mul891 commented 9 years ago

You can use the --device parameter to map the host device into the container:

docker run --device /dev/usbACM0:/dev/usbACM0 ...

However, I still have some trouble with this in that after a stop/start or restart of the container OpenHAB keeps saying device /dev/usbACM0 not found although it is still possible to open the device in the container manually eg. using cat /dev/usbACM0. Any ideas what is wrong here?

tdeckers commented 9 years ago

I'm not using a USB ZWave stick, so can't troubleshoot. Have you tried kill/rm and create new container instead of restarting an existing one? Containers should be used in a stateless fashion. You can mount data volumes if you need to hang on to data.

mul891 commented 9 years ago

Thanks for your suggestion, however that is what I'm doing right now but that is not an ideal situation. Following is shown in the log when I restart the container:

2015-11-30 20:45:44.965 [INFO ] [.z.internal.ZWaveActiveBinding:325 ]- Update config, port = /dev/ttyACM0 2015-11-30 20:45:44.966 [INFO ] [.z.internal.ZWaveActiveBinding:330 ]- Update config, healtime = 2 2015-11-30 20:45:44.966 [INFO ] [.z.internal.ZWaveActiveBinding:384 ]- Update config, softReset = false 2015-11-30 20:45:44.966 [INFO ] [.z.internal.ZWaveActiveBinding:393 ]- Update config, masterController = true 2015-11-30 20:45:44.966 [DEBUG] [.z.internal.ZWaveActiveBinding:282 ]- Initialising zwave binding 2015-11-30 20:45:44.979 [INFO ] [b.z.i.protocol.ZWaveController:146 ]- Starting Z-Wave controller 2015-11-30 20:45:44.980 [INFO ] [b.z.i.protocol.ZWaveController:154 ]- Z-Wave timeout is set to 5000ms. Soft reset is false. 2015-11-30 20:45:44.980 [INFO ] [b.z.i.protocol.ZWaveController:320 ]- Connecting to serial port /dev/ttyACM0 2015-11-30 20:45:44.987 [ERROR] [b.z.i.protocol.ZWaveController:342 ]- Serial Error: Port /dev/ttyACM0 does not exist

Strange thing is that I can open the device via the commandline and (binary) output is shown whenever ZWave-events are received from the USB-device. For now, having a workaround is fine with me. But it is cumbersome to have to remove the container only to recreate it again.

mul891 commented 9 years ago

I have another issue that may or may not be related to sharing of the usb-device. From time to time the processing of zwave-events is sloppy and events are processed after a delay of 10s of seconds or not processed at all. The web-interface however, is always responsive on the desktop or via the app. Anyone experiencing similar issues?

BennyRe commented 8 years ago

We also experience the USB issue. I have tried everything in my mind. I tried setting the -Dgnu.io.rxtx.SerialPorts parameter. Using symlinks and regular ttyUSB devices. Setting privileged: true.

Did someone resolve this issue?