question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Z-Wave Serial-over-TCP Controller

See original GitHub issue
  • OH2 Version: 2.2.0
  • Binding Version: 2.2.0

While moving the whole home IT to stateless, dockerized systems I noticed, that there is no way to connect to a TCP socket instead of a serial device. I found those functionalities in the MySensors and RFXCOM Binding and found that using them is very easy and reliable.

The hardware device that has the Z-Wave Serial Controller connected can forward that serial port to a listening TCP socket using socat or ser2net and connecting to that socket from another device yields the same exact data like talking to the serial port directliy, minus the serial settings (baud rate, stop bits, …).

I am very aware of alternatives like using socat to create a pty. All of this is not possible when the Serial Controller is not running on the same host as the openHAB docker container. So this is a feature request by design.

While I really hope that this would be relatively easy to implement, I can’t take a shot at it right now and ask for help while continuing to get my development environment up and running.


Creating a test environment on Raspbian

Prerequisites for the device host:

  • Z-Wave Serial Controller
  • root access

I am using a raspberry pi as a realistic and common example.

Installation

  • Log in to the Host
  • Become root, if not already: sudo -i
  • Install ser2net: apt-get update && apt-get install ser2net

Configuration

  • Open the config file of ser2net: vi /etc/ser2net.conf
  • Replace the content of the file with this:
2002:raw:0:/dev/zwave:115200 8DATABITS NONE 1STOPBIT HANGUP_WHEN_DONE

where /dev/zwave is the device or a symlink to the device. where 2002 is the TCP port you want to expose the device on the network.

  • Save and quit
  • Restart ser2net (after every change): systemctl restart set2net
  • netstat -lntp should show a tcp LISTEN on socket 0.0.0.0:2002 by program ser2net

Usage

  • Connect to the port and talk to Z-Wave Controller over TCP

Linux netcat example

nc openhab 2002 where openhab is the host name of the host device that has the serial controller connected.


Links

Please, let me know if I can do more to help and thank you very much!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cdjacksoncommented, Jun 1, 2018

I would suggest to comment on the ESH issue as well - at least so that people know this work is being looked at as I think it’s likely to be of interest to other bindings.

1reaction
bodirogacommented, May 31, 2018

Hi @gersilex!

I like that you have written this message, because that is what I am currently doing and its working great. To start with, I’m using this python program/script in the Raspberry Pi that acts as a gateway (I call them seriatl2tcp gateways): https://github.com/Tknika/serial2tcp-gateway

Both common Z-Wave controllers are supported (Z-Wave Gen2 and new Z-Wave+ usb devices) but it is really easy to add more just editing this file: https://github.com/Tknika/serial2tcp-gateway/blob/master/serial2tcp-gateway/device_definitions.py The TCP ports are anounced using multicast DNS (mDNS) and I have edited the binding to support this new bridge type and its discovery. I will try to push the code to my own repo tomorrow and will compile a .jar file so that you can test it and give me your opinion.

Anyway, my idea was to wait until @cdjackson merges the development branch into master and then have a conversation about how he would like to address it. But, yeah, first I should show my code and then discuss it, so tomorrow I will come back here and we can talk about it using my code as the starting point.

As always, thanks to Chris for all the time he spends for the openHAB community and best regards,

AItor

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remote Z-wave, serial over TCP/IP? - openHAB Community
I have a idea that I want to access a razberry Z-wave on a remote ... zwave controller, and mqtt is used for...
Read more >
z-wave controller - Amazon.com
Zooz 700 Series Z-Wave Plus Mesh Network Remote Control & Scene Controller ZEN34 (Battery Powered), White | Z-Wave Hub Required. Z-Wave.
Read more >
Support Multiple Z-Wave Controllers - Development
Then I want to connect it to a “remote” zwave controller that will be serial over TCP (https://github.com/Tknika/serial2tcp-gateway).
Read more >
Z-Wave Tools for Serial API commands
This article describes how to enable Serial API capturing on PC Controller and how to send SerialAPI commands to the connected Z-Wave ......
Read more >
ETS - Learning Thinknx
Zwave Controller. iRoom Controller ... Voice Control Gateway. IFTTT Account ... Serial over TCP is used when a Serial Server is used.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found