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

(Kris K) #101

If I knew how I would! :smiley:

(Chris Jackson) #102

Understood - and if I had time, I would prioritise it higher, but at the moment I don’t unfortunately (I already spend many hours every day working on openHAB, answering tickets, updating the database, etc)… I have to prioritise things and I know that people always have different priorities. If someone else can help to add this, it would be good and I suspect it should not be too much work.

(Kris K) #103

Hi All

As I cannot get a direct zwave stick connected to my OH2 box whilst also running a socat/ser2net Zwave USB stick does this allow 2 x USB sticks connected via socat/ser2net?

I already have one stick working remotely just fine, I assume all I need to do is edit socat.conf on OH2 to then have this:

OPTIONS="pty,link=/dev/ttyUSB0,raw,user=openhab,group=dialout,mode=777 tcp:"
OPTIONS="pty,link=/dev/ttyUSB1,raw,user=openhab,group=dialout,mode=777 tcp:"


On my other sharing machine ( in this instance, edit ser2net.conf with this:

3334:raw:0:/dev/ttyACM0:115200 8DATABITS NONE 1STOPBIT

With the final step being:

Add an additional Zwave Controller manually, configure the serial port for the z-wave controller thing (node1) for /dev/ttyUSB1

(Udo Hartmann) #104

No, it’s not that easy to do it. :frowning: You have to start multiple socat instances.
As the solution above uses init files, you have to copy /etc/init.d/socat to, let’s say /etc/init.d/socat2, then do a

sudo chmod +x /etc/init.d/socat2
sudo update-rc.d socat2 defaults

and of course:

sudo cp /etc/defaults/socat.conf /etc/defaults/socat2.conf

then change settings in /etc/defaults/socat2 to the second server and the settings in /etc/defaults/socat to the first server. Please ensure that /etc/init.d/socat2 will use /etc/defaults/socat2 as defaults. (line 19 in /etc/init.d/socat2)

OPTIONS is a var that is set via /etc/defaults/socat.conf, so the two lines will result in only one active setting (the second one).

There is a very smart way to do this via systemd, but for now I don’t know how to start socat via systemd correctly.

(Kris K) #105

Thanks Udo, hmmm. I dont think ill risk my working setup right now using 1 stick. Its a shame 2 sticks dont function correctly using OH2.

(Udo Hartmann) #106

Well, no risk, no fun :wink:

I did a quick research, And I think socat should work as systemd Service this way:

  1. a special systemd unit file, named socat@.service (that’s part of its magic)
Description=Socat Service

ExecStart=/usr/bin/socat -d -d -d -lf /var/log/socat/%i.log pty,link=${DEVICE},raw,user=${USER},group=dialout,mode=777 tcp:${IP}:${PORT},forever,interval=10,fork

  1. some cfg files, located in /etc/socat/ (we have to create this directory)


# EnvironmentFile for socat



# EnvironmentFile for socat

  1. Some symbolic links:
sudo ln -s /etc/systemd/system/socat@.service /etc/systemd/system/socat@usb0.service
sudo ln -s /etc/systemd/system/socat@.service /etc/systemd/system/socat@usb1.service
  1. enable systemd service:
sudo systemctl daemon-reload
sudo systemctl enable socat@usb0.service
sudo systemctl enable socat@usb1.service
sudo systemctl start socat@usb0.service
sudo systemctl start socat@usb1.service

But be warned, I did not test this yet. :slight_smile:

You can get real advantages when using many instances of a daemon (I’m running 5 squeezelight clients on one computer this way, and it’s really cool only to use one systemd unit file :wink:

(Rick) #107

Just some other tips:
My configuration only worked when i added echo=0 to the configuration.

So from

pty,link=/dev/ttyUSB0,raw,user=openhab,group=dialout,mode=777 tcp:


pty,link=/dev/ttyUSB0,raw,echo=0,user=openhab,group=dialout,mode=777 cp:

Also with the newer versions of ser2net, you can make multiple connections to one serial port by adding max-connections=N to the configuration. For the dutchies this might be handy when using a DSMR data logger and a seperate OpenHAB instance.

Just for reference, my ser2net line is

3333:raw:0:/dev/ttyUSB-P1:115200 8DATABITS NONE 1STOPBIT max-connections=3

Ser2net is downloadable from

(Rich Koshak) #108

I’d like to now this is strictly a limitation of socat and is completely outside of OH itself. OH has no problem working with multiple USB devices.

(Kris K) #109

Not with multiple usb z wave sticks it doesnt. At least not on my setup ysing 2 x aeotec gen 5 sticks

(Rich Koshak) #110

It is supposed to. You create two zwave controller Things each connected to a different /dev/tty.

What specific problem are you experiencing?

If the problem is getting a device to appear as a /dev/tty remotely using socat/ser2net, then the problem is outside of OH.

(Thomas Bail) #111

I tested it with two socats as described in the other tutorial and it worked fine

(Kris K) #112

Hi Rich

See my post here:

I couldnt get 2 x ZWave sticks working. One connected via socat works just fine, when I connect a local controller it wouldnt discover it. When I added it manually I had all sorts of issues as described in the thread.

(Rich Koshak) #113

All the problems read like they are a problem with the controller, not the fact that it happens to be the second controller. Do you see the same errors when adding that controller by itself?

(Kris K) #114

One controller works fine, either via socat or via the USB port.

Its the second controller because when its inserted/removed those errors come up and also the second controller fails to display a new item in the inbox after a successful pair.

(vossivossi) #115

This must be specific to your setup, but is not true for OH. I am even using 3 x Aeotec Gen5 Sticks parallel in my production environment for more than 1,5 years without any problems.

(Kris K) #116

Id love to be able to fix it but I didnt get any guidance. What version of the Zwave binding

(vossivossi) #117

At the moment I am running OH Snapshot 2.4 1407 with Z-Wave Binding but it worked ever since May 2017 for me with the Z-Wave dev version (which became part of the Snapshots later, I think shortly after 2.3 release?). Which one do you use?

(Kris K) #118

I use this version

2.4.0-SNAPSHOT Build #1341

251 │ Active   │  80 │     │ ZWave Binding

(vossivossi) #119

This might be one day too old… :frowning:
Chris merged to dev version on September 9th in the 2.4 master branch…

(Kris K) #120

Oh. How do I obtain that newer version?