Main Server with Zwave and RaspberryPi's

  • Platform information:
    • Hardware: amd64, ARM/8GB, 1GB/20GB, 8GB
    • Java Runtime Environment: OpenJDK 8
    • openHAB version: 2.4
  • Issue of the topic:

I’m having trouble finding a clear answer on this. I have a dedicated OpenHAB server, a RaspberryPi, an AEOTEC Z-Stick, and an AEONTEC z-wave bulb. Further down the line I might have more RaspberryPi’s that will have a specialized function (Zigbee, LEDs, and other GPIO connected stuff, etc…).

As an initial test setup the Z-Stick will be plugged into the USB port of the RaspberryPi. From what I understand after reading through these forums, I do not need to install OpenHAB on the RaspberryPi.

How then do I add the Z-stick to OpenHAB?

ser2net & socat are your Friends for ZWave on Dedicated RaspberryPI :slight_smile:

Zwave2Mqtt is probably a way of doing it that removes it from openhab.

Technically I’d almost stand up a small openhab system for just the zwave, and publish via eventbus/mqtt2 publishing to your primary system.

1 Like

it is kind of the best in the business right now
thanks @chris

1 Like

ser2net/socat is an interesting idea. I wasn’t aware such a thing existed. I tested it out and I ran into issues with permissions on the device file it’s creating on the receiving end. I’ll revisit that again later.
In the mean time, I’d like to explore the eventbus/mqtt2 option mentioned. Where can I find some documentation on that?

1 Like

If Primary & Secondary openhab System is in the same House, than it makes no sense to mange 2 Systems … this only makes sense if you wan’t connect 2 Houses over Internet …

I’m happy to report that my test setup using ser2net and socat is successful. I’m posting my configs here for future reference (and for anyone else that might find it helpful).

Main Server

OS: FreeBSD 12.0

Install/Setup OpenHAB and Socat

pkg install -y socat openhab2 openhab2-addons
sysrc openhab2_java_opts="-Djava.net.preferIPv4Stack=true -Dgnu.io.rxtx.SerialPorts=/dev/cuau0"  openhab2_enable="YES"  socat_enable="YES" socat_daemonuser="root"

Setup socat using /usr/local/etc/socat-instances.conf (this is FreeBSD specific). 192.168.0.61 is IP of RaspberryPI 3.

[zstick]
flags="pty,link=/dev/cuau0,user=uucp,group=dialer,mode=777,raw tcp:192.168.0.61:3333"

There was one slight issue with permissions for /var/spool/lock. OpenHAB was unable to create lock files in that directory. This was fixed by opening up the permissions to rwx for all users.

chmod 777 /var/spool/lock

A better approach might be to add the openhab user to the dialer group on the OS level.

Start services

service socat start
service openhab2 start

RaspberryPI 3

OS: FreeBSD 12 for RPI3

Extract and write OS image to SD card (/dev/daX)

fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/12.0/FreeBSD-12.0-RELEASE-arm64-aarch64-RPI3.img.xz
unxz FreeBSD-12.0-RELEASE-arm64-aarch64-RPI3.img.xz | dd of=/dev/daX bs=10M

Install/Setup ser2net

pkg install -y ser2net
sysrc ser2net_enable="YES"

Setup ser2net by putting this line into /usr/local/etc/ser2net.conf. Where /dev/cuaU0 is the device name of the z-stick

3333:raw:0:/dev/cuaU0:115200 8DATABITS NONE 1STOPBIT

Start services

service ser2net start

OpenHAB

Then just follow the tutorial at https://www.openhab.org/docs/tutorial/configuration.html, add your Z-Wave Serial Controller by pointing to /dev/cuau0.

2 Likes