openHAB + ZWave: solving the „Port … does not exist“ problem


I recently ran into issues getting ZWave to run on openHAB 2 on my new hardware: an Odroid C2.

I added the ZWave binding to the openHAB installation, provided the port of the ZWave USB Stick in the configuration settings and… nothing happened. openHAB insisted that the „Port /dev/ttyUSB1 does not exist“. Well, it did, at least I could see it when doing

ls /dev/ttyUSB1

Here’s a list of checks to perform to solve similar issues. Note that you’ll have to adjust the commands to use your port (which might be different from ttyUSB1). If you’re unclear on what port you need to use, do a „tail -f /var/log/syslog“ and then unplug and re-plug your ZWave adapter. The log will tell you the device name.

Check for permission issues

When doing „ls -l“

root@smarthome:~# ls -l /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 1 Jun 23 21:07 /dev/ttyUSB1

it will typically say that the port is owned by group „dialout“. So, make sure you add the user that runs openHAB to the dialout group, like this:

usermod -a -G dialout openhab

You will have to restart openHAB for these changes to be effective.

Still not working? Running on 64Bit hardware? Then

Check for 64Bit issues

The ZWave binding seems to have a dependency on a 32Bit native library. To check whether you have a library issue, do a

cat /var/log/syslog | grep libNRJavaSerial

If there are matches, please inspect your syslog in detail. It is likely to contain errors like this:

Jun 22 21:09:17 smarthome karaf[19652]: #011at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76)
Jun 22 21:27:37 smarthome karaf[20408]: java.lang.UnsatisfiedLinkError: /var/lib/openhab2/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: /var/lib/openhab2/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
Jun 22 21:27:37 smarthome karaf[20408]: #011at gnu.io.NativeResource.loadResource(NativeResource.java:142)
Jun 22 21:27:37 smarthome karaf[20408]: #011at gnu.io.NativeResource.inJarLoad(NativeResource.java:40)
Jun 22 21:27:37 smarthome karaf[20408]: #011at gnu.io.NativeResource.loadLib(NativeResource.java:60)
Jun 22 21:27:37 smarthome karaf[20408]: #011at gnu.io.NativeResource.load(NativeResource.java:28)
Jun 22 21:27:37 smarthome karaf[20408]: java.lang.UnsatisfiedLinkError: /var/lib/openhab2/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: /var/lib/openhab2/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
Jun 22 21:27:37 smarthome karaf[20408]: #011at gnu.io.NativeResource.loadResource(NativeResource.java:142)
Jun 22 21:27:37 smarthome karaf[20408]: #011at gnu.io.NativeResource.inJarLoad(NativeResource.java:40)
Jun 22 21:27:37 smarthome karaf[20408]: #011at gnu.io.NativeResource.loadLib(NativeResource.java:60)
Jun 22 21:27:37 smarthome karaf[20408]: #011at gnu.io.NativeResource.load(NativeResource.java:28)

Basically this says you’re trying to load a 32Bit library from within a 64Bit process. The easiest solution is to switch to 32Bit Java

sudo dpkg --add-architecture armhf
sudo apt-get update
sudo apt-get install openjdk-8-jre-headless:armhf

This will install 32 Bit Java 8. Now, let’s make this the default Java runtime on the system:

update-alternatives --config java

Again, this change will require a restart of openHAB.

This solved the ZWave problem for me.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.