OpenHAB 2.4 Serial Gateway problem
-
I have a hard time getting the Serial GW working with OpenHAB in a docker container.
I have a discussion running over at OpenHAB but they can't help me further maybe someone here has some experince in installing a serial GW. Here is the URL of the discussion and here is the main problem:
https://community.openhab.org/t/dev-ttyusb0-no-such-port-again/85021/20I use the binding MySensors. The instillation went well and I could add the Port Settings in the PaperUI.
However I get this error:
06:13:46.071 [DEBUG] [ocol.serial.MySensorsSerialConnection] - Connecting to /dev/ttyUSB0 [baudRate:115200] 06:13:46.072 [ERROR] [ocol.serial.MySensorsSerialConnection] - No such port: /dev/ttyUSB0
gnu.io.NoSuchPortException: null
at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:273) ~[260:com.neuronrobotics.nrjavaserial:3.15.0.OH2]
at org.openhab.binding.mysensors.internal.protocol.serial.MySensorsSerialConnection.establishConnection(MySensorsSerialConnection.java:51) [275:org.openhab.binding.mysensors:2.4.0.201812040738]
at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection.connect(MySensorsAbstractConnection.java:148) [275:org.openhab.binding.mysensors:2.4.0.201812040738]
at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection.run(MySensorsAbstractConnection.java:127) [275:org.openhab.binding.mysensors:2.4.0.201812040738]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]OpenHab is running in a docker container with those additional arguments:
EXTRA_JAVA_OPTS = -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0
devices:
/dev/USB0:/dev/USB0
So /dev/ttyUSB0 is for sure the right port.
I can read the data withcat /dev/ttyUSB0
On the linux server and when I go to the docker with:
docker exec -it openhab /bin/bash
I can also read the serial port by using the same command:
cat /dev/ttyUSB0
I also added:
adduser openhab dialout
adduser openhab ttybut somehow each time I restart the docker I need to add the
adduser openhab tty
command again....
when I enter this command:
docker logs openhab
I get a long list with this error:
java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver
And here is the log when OpenHAB is booting up:
06:37:25.990 [DEBUG] [org.openhab.binding.mysensors ] - BundleEvent STOPPED - org.openhab.binding.mysensors 06:37:25.992 [DEBUG] [org.openhab.binding.mysensors ] - BundleEvent STARTING - org.openhab.binding.mysensors 06:37:25.993 [DEBUG] [org.openhab.binding.mysensors ] - BundleEvent STARTED - org.openhab.binding.mysensors 06:37:25.999 [DEBUG] [org.openhab.binding.mysensors ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=507, service.bundleid=275, service.scope=bundle, component.name=org.openhab.binding.mysensors.factory.MySensorsHandlerFactory, component.id=339} - org.openhab.binding.mysensors 06:37:26.054 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge 06:37:26.054 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'mysensors:bridge-ser:616dc2bb' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING 06:37:26.055 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist. 06:37:26.056 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache (given_ids) content: [] 06:37:26.057 [DEBUG] [ocol.serial.MySensorsSerialConnection] - Enabling connection watchdog 06:37:26.066 [DEBUG] [ocol.serial.MySensorsSerialConnection] - Connecting to /dev/ttyUSB0 [baudRate:115200] 06:37:26.066 [DEBUG] [org.openhab.binding.mysensors ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=508, service.bundleid=275, service.scope=singleton} - org.openhab.binding.mysensors 06:37:26.066 [ERROR] [ocol.serial.MySensorsSerialConnection] - No such port: /dev/ttyUSB0
What else can I do what might be the problem?