ZWay UZB Installation on Debian x64 Hardware

I have run my own zwave server for some time using Node.js to communicate directly with a controller dongle. Recently I purchased a ZWay UZB stick so that I could focus on writing applications instead of driver layer software for zwave.

I had ZWay working fine on an older version of Ubuntu of but I wanted to install a supported version (Ubuntu 14.04) but after installing a clean Ubuntu 14.04 then running the install for ZWay I found it was horribly broken.

There appears to be little or no information about getting ZWay installed on Ubuntu or Debian other than a little snippet on the ZWay installation page:

Z-Way for RaZberry is supported on Raspbian distribution for Raspberry Pi computer. Although it can be launched on other Raspberry Pi distributions too.

It turns out what this means is you need to manually download a debian version and then manually set it up.

So:

Install some dependencies first:

apt-get -y update
sudo apt-get -qy install libxml2 libarchive-dev curl
sudo apt-get -qy install sharutils tzdata gawk
sudo apt-get -qy install libavahi-compat-libdnssd-dev

Link a dependency with newer name:

sudo ln -s /usr/lib/x86_64-linux-gnu/libarchive.so.13 /usr/lib/x86_64-linux-gnu/libarchive.so.12

Go to http://razberry.z-wave.me/z-way-server and download the latest version 2.0.1 to your server, I used http://razberry.z-wave.me/z-way-server/z-way-server-Ubuntu-v2.0.1.tgz

I tried ALL other versions including later ones and NONE worked. Only 2.0.1 would work!

UPDATE I was able to get the newer versions 2.1.1 and 2.1.2-rc17 working but I had to contact zwaveeurope.com (the retailer of my UZB stick) and request a new license key. After starting 2.1.1 and entering the new key into zway, I was able to get it working. Version 2.1.2-rc17 also worked after the new key was entered.

Get the file:

wget http://razberry.z-wave.me/z-way-server/z-way-server-Ubuntu-v2.0.1.tgz

Untar the zip file:

sudo tar -zxf z-way-server-Ubuntu-v2.0.1.tgz -C /opt/

Create a service installer file:

nano install-service.sh

Paste the below text into it:

#!/usr/bin/env bash

# Create Z-Way startup script
echo "Creating Z-Way startup script"  
echo '#! /bin/sh  
### BEGIN INIT INFO
# Provides:          z-way-server
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Z-Way service
# Description:       Start Z-Way server for to allow comms with Z-Wave devices
### END INIT INFO

# Description: Z-Way server
# Author: Rob Evans <rob@irrelon.com>

PATH=/bin:/usr/bin:/sbin:/usr/sbin  
NAME=z-way-server  
DAEMON_PATH=/opt/z-way-server  
PIDFILE=/var/run/$NAME.pid

# adding z-way libs to library path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/z-way-server/libs

case "$1" in  
  start)
    echo -n "Starting z-way-server: "
    start-stop-daemon --start  --pidfile $PIDFILE --make-pidfile  --background --no-close --chdir $DAEMON_PATH --exec $NAME > /dev/null 2>&1
    echo "done."
    ;;
  stop)
    echo -n "Stopping z-way-server: "
    start-stop-daemon --stop --quiet --pidfile $PIDFILE
    rm $PIDFILE
    echo "done."
    ;;
  restart)
    echo "Restarting z-way-server: "
    sh $0 stop
    sleep 10
    sh $0 start
    ;;
  save)
    echo "Saving z-way-server configuration"
    PID=`sed s/[^0-9]//g $PIDFILE`
    /bin/kill -10 $PID
    ;;
  *)
    echo "Usage: /etc/init.d/z-way-server {start|stop|restart|save}"
    exit 1
    ;;
esac  
exit 0' > /etc/init.d/z-way-server  
chmod +x /etc/init.d/z-way-server

# Add z-way-server.log to logrotate
echo '/var/log/z-way-server.log {  
        daily
        size=10M
        rotate 4
        compress
        nodelaycompress
        missingok
        notifempty
        postrotate
            /usr/bin/killall -HUP z-way-server 2>/dev/null || true
        endscript
}' > /etc/logrotate.d/z-way-server

# Add Z-Way to autostart
echo "Adding z-way-server to autostart"  
update-rc.d z-way-server defaults  

Now run the service installer:

sudo bash install-service.sh

To check for any issues and see debug output you should manually launch z-way-server and look at the debug log on screen for any issues. To do that you can run (in the z-way-server folder):

cd /opt/z-way-server
LD_LIBRARY_PATH=libs ./z-way-server

Once you are satisfied everything is working by navigating to your server's IP under port 8083, you can start your z-way-server service via:

sudo service z-way-server start

Enjoy!