OpenHAB2 + Razberry + Z-Wave Binding

Hi, I am currently trying to get the Raspberry Pi/Razberry Board going with OpenHAB2. From what I have researched, I need to put the Openhab2 jar, Z-wave jar, and Serialio jar in a location within Openhab2 (lost the link with the location). I am unable to find these files, and the links in the older forums are no longer valid. I have currently added the Z-wave binding, and unsuccessfully created a Z-wave thing. Logging and the PaperUI are showing that the /dev/ttyAMA0 does not exist. Can anyone please shed some light on what I may be doing wrong here? I have read quite a bit on this, and am missing something.

To install ZWave in OH2, simply use PaperUI, go to Extensions, and select Bindings, and then ZWave. It will resolve the dependancies and should install the system. After that, you can follow the instructions here -:

http://www.cd-jackson.com/index.php/openhab/habmin/10-habmin-zwave-binding-initialisation

@chris - Thanks for taking the time to help. I did follow the instructions posted accordingly. I am using the offline version, and during startup, the serial port is not initialized.

When going to ‘Things’, and after I add a device, and set the serial port to ‘/dev/ttyAMA0’, it states the device does not exist.

I also followed this link here to try to resolvehttps://community.openhab.org/t/solved-how-to-define-a-serial-port-on-raspberry-for-openhab2-for-my-razberry-zwave-binding/6693, with no luck.

If it’s stating that the device doesn’t exist, then I think the binding is all installed ok. If you didn’t have the binding, and its dependancies installed, then the binding wouldn’t actually start.

I’m afraid I can’t help on the serial port. I see a lot of messages about problems with the RPi serial ports, and as I’m not running one, I can’t comment - sorry.

Hopefully someone else will be able to point you in the right direction.

Ok @chris - again, thanks for the feedback.

I wanted to mention I did get this setup working with OH1. Could there be any conflicts by chance? I did stop services accordingly.

If it worked on OH1, then it should work with the same port etc with OH2. The serial driver, and the ZWave code that deals with this is the same on OH1 and OH2.

I wouldn’t expect any conflicts. If you uninstalled, or even just aren’t running OH1, then it should be ok.

What version of JDK are you running?

@chris I did a fresh install of Raspian and installed the z-way package and got the Razberry working with that software.

But now after I install OpenHAB2, it hangs at [.dashboard.internal.DashboardService] - Started dashboard at /start.

Any ideas?

JDK 8 is the version.

Does Z-Way leave something running in the background (ie does it have a daemon running)? If it’s using the same port that OH wants to use it might cause this.

It might be worth putting the system into debug mode to see what’s happening.

Hey Chris,

So I am trying to get DEBUG going - I have visited
http://www.cd-jackson.com/index.php/openhab to try to get it enabled. By
console, do you mean a shell session is where I enter this at the
prompt *log:set
debug org.openhab.binding.zwave? *I am getting an error. I am new to OH2,
so all of this is still foreign.

Thanks for working with me,

Bud

It looks like I can get some feedback running the start_debug.sh. After doing so, and after editing the
([Solved] How to define a serial port on raspberry for openhab2 for my razberry zwave binding?)

setenv

in file “setenv” at /opt/openhab/runtime/karaf/bin
you need to add the parameter -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0
just to make sure that karaf is aware on the JVM parameter.

for me those are now:

export JAVA_OPTS="${JAVA_OPTS}
-Dopenhab.home=${OPENHAB_HOME}
-Dopenhab.conf=${OPENHAB_CONF}
-Dopenhab.runtime=${OPENHAB_RUNTIME}
-Dopenhab.userdata=${OPENHAB_USERDATA}
-Dorg.osgi.service.http.port=${HTTP_PORT}
-Dorg.osgi.service.http.port.secure=${HTTPS_PORT}
-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0"

still no dice.

So is there another way to define the serial port in OH2?

Resolved. It was a syntax error.

For those using the Razberry board, it seems that this line -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0" needs to be added to /usr/share/openhab2/runtime/karaf/bin/setenv under

export JAVA_OPTS="${JAVA_OPTS}

at the end and the ending quote needs to be removed after -Dorg.osgi.service.http.port.secure=${HTTPS_PORT}".

export JAVA_OPTS="${JAVA_OPTS}
-Dopenhab.home=${OPENHAB_HOME}
-Dopenhab.conf=${OPENHAB_CONF}
-Dopenhab.runtime=${OPENHAB_RUNTIME}
-Dopenhab.userdata=${OPENHAB_USERDATA}
-Dorg.osgi.service.http.port=${HTTP_PORT}
-Dorg.osgi.service.http.port.secure=${HTTPS_PORT}
-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0"

Thanks for the help @chris and @peter_seelinger.

Debugging still seems to be a mystery, but I will keep tinkering.

What is the error?

Note that starting with the debug script still won’t enable debugging until you enable it in the console.

I am under the impression I can type log:set debug org.openhab.binding.zwave at the SSH shell. When I do that, I receive the error -bash: log:set: command not found.

Thanks @chris

This command should work. Are you logged in to the correct console? What do you see when you log on (do you see the openhab logo), and what do you see when you type ‘help’ (eg lots of OH commands)?

Got it resolved by launching ./client
Thanks @chris - you’ve been great.

I seem to be struggling with OpenHab 2 connecting to the Razberry board. I had it working a few months ago with a manual installation of the beta, but due to a corrupted SD card I lost that work.

The difference this time is that I installed OpenHAB2 as a service.

The z-wave network was setup using the Z-way software, as I did last time. I then stopped the z-way-server service before starting the OpenHab2 service.

I added the line to the setenv file under /usr/share/… , making sure the ’ " ’ was in the right place. Still no dice, however. Upon start up OpenHab2 does not recognize ttyAMA0.

Hi I’ve also experienced issues with this.
See: /dev/ttyAMA0 does not exist on RasPi2 & OH2

Basically for me it works when using /dev/ttyUSB30 in the configuration of the Z-wave controller:

root@firefly:/dev# ls -l tty*USB*
lrwxrwxrwx 1 root root 7 Sep  5 20:38 ttyUSB30 -> ttyAMA0
root@firefly:/dev# ls -la *ttyAMA0*
crw-rw---- 1 root dialout 204, 64 Sep  9 09:49 ttyAMA0

Where ttyUSB30 is a symbolic link.

Hi @Seaside, thank for your response.

I created the symbolic link as per that thread, and changed the setenv file and the openhab config to reflect that change.

I rebooted the OpenHab2 service, but now it just says /dev/ttyUSB30 does not exist.

pi@raspberrypi ~ $ ls -l /dev/tty* crw-rw---- 1 root tty 204, 64 Dec 31 1969 /dev/ttyAMA0 lrwxrwxrwx 1 root root 12 Sept 9 06:57 /dev/ttyUSB30 -> /dev/ttyAMA0

Do I need to restart the pi for these changes to work?

Edit: Just tried rebooting, and adding user pi and openhab to group tty. Still no change.

Edit2: I was finally able connect. The answer was staring me in the face. Adding user pi to group tty was what I needed, combined with @budghiss 's solution.

Hi Connor,

I have not been using OH2 lately, I reverted back to OH1 for the time being.

I as well believe I used z-way before launching OH2 - this may not be
mandatory though.

To get z-way working properly, I had to use:

echo 900 >
/opt/z-way-server/automation/storage/8084AccessTimeout-6b497208061ec7faae003cdd7f9a035e.json

As for OH2, I made a short script to try to step through the install.

Also, this script has the offline version - you should now be able to use
apt-get.

Let me know if this helps.

#!/bin/bash

sudo apt-get install apt-transport-https

sudo echo deb
https://openhab.ci.cloudbees.com/job/openHAB-Distribution/ws/distributions/openhab-offline/target/apt-repo/
/ >> /etc/apt/sources.list
sudo apt-get install openhab2-offline

sudo chown -hR openhab:openhab /etc/openhab2
sudo chown -hR openhab:openhab /usr/share/openhab2

sudo apt-get install samba samba-common-bin

sudo cp -v smb.conf /etc/samba/

#verify /etc/samba/smb.conf -> wins support = yes and openhab parameters
are set at bof

sudo smbpasswd -a openhab

sudo update-rc.d smbd enable
sudo update-rc.d nmbd enable
sudo service smbd restart

sudo usermod -a -G dialout openhab
sudo usermod -a -G dialout pi
sudo usermod -a -G dialout root
sudo usermod -G tty openhab

#edit  /usr/share/openhab2/runtime/karaf/bin/setenv to
#export JAVA_OPTS="${JAVA_OPTS}
#-Dopenhab.home=${OPENHAB_HOME}
#-Dopenhab.conf=${OPENHAB_CONF}
#-Dopenhab.runtime=${OPENHAB_RUNTIME}
#-Dopenhab.userdata=${OPENHAB_USERDATA}
#-Dorg.osgi.service.http.port=${HTTP_PORT}
#-Dorg.osgi.service.http.port.secure=${HTTPS_PORT}
#-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0"

Rob

Hi Rob,

Thanks for taking the time to send me that info.

I had previously added openhab and pi users to dialout, but I hadn’t to
tty. Once I did that I was able to connect to AMA0.

Thanks again,

Connor