Serial over tcp

Would be really nice to get a component/integration to connect to serial port over IP, and to be able to connect to mulitple ports.

Usage example

  • Raspberry Pi connected with a Z-wave stick and Conbee stick to get a portable Z-wave/ZigBee gateway (with a powerbank connected ofc)
  • Build a clustered solution of HA using docker swarm or other cluster functions.

There is a github of someone who started to develop a function for it, but I have no idea if this is useful or not since I’m not a developer by any means.

I’ve also added a ticket in the architecture section of github https://github.com/home-assistant/architecture/issues/116

As someone who runs hass.io virtualized on ProxMox, this would be huge in automating my Z-Wave integration. Currently I have to execute the following commands from my Home Assistant VM to make to get this to work:

docker restart homeassistant
docker exec homeassistant socat pty,link=/dev/zwave,ignoreof,echo=0 tcp:192.168.1.235:3335, forever &

You mean that you’ve got this working just by using that line? And then point your z-wave config in configuration.yaml to /dev/zwave ?

Yes, but it needs to be run immediately after you start the container, otherwise the Z-Wave component will fail to communicate during the Home Assistant startup, and all of your Z-wave devices will be missing.

To be clear, I’m using ser2net to serve my Z-Wave device, and socat to connect to it.

Does it work reliably? I am hoping for a native integration into home assistant as I’m afraid of messing with docker, I really don’t wanna break anything…

Any pointers on setting this up?

Yes, I would also recommend to look into socat - I’ve not been using it to do serial over the network, but it probably can expose it.

I have the next line in one of my scripts to monitor a serial link. It will connect to ttyS1, and create a virtual port on ttyV0, logging all the traffic to INLOG, VERBOSE_OPT is -x -v when I want to:

 socat ${VERBOSE_OPT} -lu /dev/ttyS1,raw,echo=0,b${BAUDRATE} "PTY,link=/dev/ttyV0,raw,unlink-close" >& ${INLOG} &

Originally socat is for networks, so if it can’t bridge between the serial port and the network, I’ld be surprised.

What’s more complex is to ensure that it remains up (when the connexion is interrupte, serial restarted, etc).

The server side of that is pretty much done with GitHub - akshmakov/serialport-server: "COM"-Style Serial Port server with socat which itself can be provided via a docker container.
I have that currently running, exposing a BENQ projector (and atm working on getting it up with the HACS Benq projector integration - which is funny, because i wrote one myself years ago, but it was a lot less polished - but it worked as a proof of concept).

Any updates on this? I recently installed a BenQ X3100i that I’d like to control via serial / RS232.

I modified some code from GitHub to be able to use Epson projectors using the official Home Assistant Epson Projector Link Integration.
You can find it here: https://github.com/alwe2710/SerialProjectorLink
With few modifications it should also work for other brands if there are already integrations for Home Assistant out there.
Not the most beautiful code but its does the job.