Share Z-wave dongle over IP (USB over IP using ser2net / socat ) guide

Hi Vossi,

I think this thread was more about debugging zwave dongles, but the techniques apply to any serial device sharing over network. I don’t know if the windows versions of socat / ncat / nmap will work but the 115200 baudrate is correct for the alarmdecoder serial device. You are right though, I have some experience in windows serial devices and slower baud rates seem to help. I might try that with alarmdecoder.

I have also tried using it with Home Assistant, and have experienced no hangs there, so my suspicions are in the OpenHab AlarmDecoder binding hanging.
Thanks for the feedback.

Is it working as same as Homeseer Z-NET?

Thanks for pointing out how to get socat / ser2net into a docker container :slight_smile:

Can you perhaps briefly describe how you build the socat connection on the NAS? I have now just made a script in the task scheduler when booting.

socat pty,link=/dev/ttyUSB0,raw,user=docker,mode=777 tcp: &

I do not think that’s the perfect solution, even if it works.

In my configuration, I also added a boot-up task in Task Scheduler. The Run command is:
nohup /volume1/docker/openhab/diskstation-configuration/scripts/ &
and my script ( is similar to yours, with the addition of a while loop to restart socat when it might fail:

while sleep 1; do
        TIMESTAMP=`date +%Y%m%d_%H%M`
    cp $LOGFILE ${LOGFILE%.log}-${TIMESTAMP}.log
        echo "% Start logging on ${TIMESTAMP}" > $LOGFILE
    /usr/local/bin/socat -d -d -d -lf $LOGFILE pty,link=/dev/tty$DEVICE,raw,user=openhab,group=openhab,mode=777 tcp:$REMOTEIP:$REMOTEPORT
1 Like

Thanks :slight_smile:

systemctl would be the right answer here.

I wrote a tutorial on how to use AlarmDecoder with SSL; it had similar requirements. Look at how it used systemctl to set up.

No … Synology Diskstation … Docker … No systemd…

Sorry, missed that. Saw the other discussion of systemctl and thought that’s the part that was missing.

Hi All,

Just wondering if anyone has managed to fix the issue assocaited with the Zwave binding being stuck if the ser2net/socat link breaks?

I find the I/O errors pop up on OpenHab. A restart of socat/ser2net fixes the link, but then one must manually restart the binding for ZWave to return.

Be keen to know how your systems have self healed using ser2net/socat


I meanwhile managed to have this stable but with a Windows based OH server in my setup. I am now using Raspis with ser2net to feed the serial connection into the LAN and on the Windows machine I am using com0com and hub4com as clients (it took me days of testing and tweaking before I successfully managed to have the Linux serial server talking to the Windows serial client).
The virtual COM ports created by com0com on the Windows machine remain persistent even if the connection is interrupted. So there is no exception thrown on the OH side anymore. And when the connection recovers everything just continues to work as before the interruption without any need of restart of the Z-Wave binidng anymore. For me that is the best solution I ever had (an I tested all kind of solutions for nearly 2.5 years to have that connection stable).

1 Like

Cool, Windows isn’t a solution for me though. I wonder why it changes using Windows? It appears these tools do not auto recover in linux

Hi vossi, how do you stop the thousands of zwave updats to the group? or do you only make your zwave switches part of the group?

Actually I have 3 groups as I do have 3 Z-Wave sticks (and therefore 3 networks). ALL items of one network are members of the specific group. So the time stamp is updated very frequently (which is on purpose as I want to monitor this “heartbeat”).

Wow, thats ALOT of traffic! like every second

What’s the problem? Are you running on a Pi with SD Card? :wink:

No, ive got PLENTY of grunt, but i just dont want my karaf log full of the updates every second.

So you’re using 3 controllers on one OH2 system with 2 remote machines connecting the controller to OH2 via socat/ser2net?

3 remote machines. I separated the sticks completely physically from the OH-Server. They are all connected over IP.

Interesting :slight_smile: you must have a very distributed building. And very reliable from your previous posts. Are they all MAIN controllers? I assume then different nodes are paired with the respective controllers

Yes, all are MAIN controllers. The pairing needs to be done with the correct controller for that part of the building. Unfortunately the OH Z-Wave binding does NOT support a selective inclusion mode only for one controller. Instead all my 3 controllers go into pairing mode when launched via Habmin. If the device is located only within range of one controller this will work. If there are 2 controllers close to the device, I “disconnect” (stop ser2net) the other controller and then click on network wide inclusion.

1 Like

For those interested…

i’ve updated my initial post with a setup for running multiple socat instances on the OpenHAB machine connecting to multiple ser2net nodes in your network simultaniously.
This might be helpful if you require e.g. multiple Z-wave nodes to cover a large or complex installation. I’ve tested it and it seems rock solid. Autostart of multiple socat instances at (re)boot and logging into separate log files for each instance (/var/log/socatx.log)



1 Like