Hass.io remote z-wave module with socat/ser2net?


#1

Long story short, I am moving from the far less reliable Rasberry Pi build to a VM on enterprise grade hardware. The only problem with this is I bought a RaZberry Z-Wave module back when I was running HASS on the Pi.

Now, I can get the remote Z-Wave module to work within the VM using socat. However, the “factory” HassIO docker container doesn’t want to connect to the remote Z-Wave. This is because the socat virtual device isn’t in udev (CentOS docker host) and it seems the pre-built docker container doesn’t map the device unless it is.

On to the question at hand… Does anybody know how to actually make this work? I am thinking something like https://community.home-assistant.io/t/docker-image-to-manage-home-assistant-and-socat-for-using-remote-zwave-stick/52555 But that is for the full HA variant… and I would like to keep the functionality of HassIO (auto-updates, plugins, etc). I have tried creating socat udev rules with little success (basic Linux experience) and also trying to get the official docker container to map the device manually (with --device=/dev/ttyUSB0). Everything else in my VM build is working great, but I would like to connect back to my Z-Wave network. This would also make it possible to move my Z-Wave hub to a more central location in the house by just running an ethernet cable to it. Thus, decrease latency on the Z-Wave network and make it more reliable than say a USB device at the far end of the house in my soundproof server room.

Also, before anybody asks/suggests a few things… No, I’m not just going to switch back to the Pi for HASS, it is slow and SD cards are garbage for reliable storage (compared to enterprise disks). No, I’m not going to just use the regular HA build, the future is moving to HassIO and I want the functionality included with that. Finally, no, I really don’t want to just sell/buy/replace my Z-Wave module… this seems like it shouldn’t be that hard to do, and I don’t see the point of spending more money just to avoid some additional coding/dev time.

Thanks for anybody that can help!


Hassio and socat
#2

The VM I’m using is built from the “Alternative Linux Install” from here: https://www.home-assistant.io/hassio/installation/ and here: https://github.com/home-assistant/hassio-build/tree/master/install

The main install page mentions needing socat, but I’m not sure why…


#3

Hey @brianara3 - completely agree. Run HA on a proper server with power redundancy, disk redundancy, and not a Pi. Most people on here seem to disagree, that’s their prerogative…

I have my automation hub (Node-RED right now - but moving some of it to Home Assistant) set up to use socat to connect to a remote COM port.

Does your z-wave hardware create a com port on the Pi? Not sure if this helps, but here’s how I have mine configured on the receiving end. I created a system service to run the following command, which connects to a COM port being served on a remote machine:

socat pty,link=/home/mat/virtualcom0,raw tcp:10.1.1.34:2101

This basically creates the com port on the local machine, effectively meaning I can access a remote USB device.

Cheers

Mat


#4

Yep, I got that far already… ser2net on pi, maps z-wave to network, then socat as a service on the VM maps to a virtual device. All of that works great and if I install HA native on the VM OS it works. Problem comes when I try to run the full HassIO docker image. After some discussion on discord it seems that the docker container looks at udev to map devices into the container, but the service created virtual device isn’t listed in udev.

I mainly want to build in the HassIO image because it is a ton easier to install/maintain things like Node-Red with the plugin system. I didn’t really want to build everything manually and the plugins allow me to add/remove components in a few clicks.

Basically I want my cake and eat it too. :grin:


#5

Ive been trying the Hass.io alternative install on a generic Linux server (Ubuntu server VM on UnRaid) for a few days but Im using usbip instead of socat/ser2net as described at RPi as Z-Wave/ZigBee-over-IP server for Hass

Seems to work fine so far…

I also used tips from Zwave usb path keeps changing to find out the correct usb_path to use.

Regards,
Gilson


#6

My only concern with usbip is that the RaZberry GPIO module doesn’t show up as a “usb” device, ie. nothing shows when you do a lsusb on the PI. I will have to check this out and see what I can do with it.


#7

Ahh, now I understand. And in fact, this is what I’d like to do as well. I didn’t fully understand this bit of what you wrote:

In my case, I have downloaded Hass.io as a VHDX file (virtual hard disk) and simply run this in Hyper-V. I’ve installed the SSH plugin, but I can’t find a way to actually install socat. So it sounds like you’ve got further than me.

Can you tell me what you did to be able to even run socat on a server with Hass.io? (Or did you install Hass.io in an existing Linux server?)

Hope the above makes sense


#8

I installed HassIO on a CentOS Linux server using the “Alternative Linux install” from here: https://github.com/home-assistant/hassio-build/tree/master/install

This allows me to get all the features of HassIO and still be able to add non-plugin items on the host system (remote access, backups, socat). Initially I just ran HA natively on CentOS, but it became very complicated to install things like Node-Red, IDE/configurator, etc and still have everything work seamlessly together. This Z-Wave thing is the only hangup I have now, and it’s only because I didn’t buy a USB Z-Wave device when I started with HA (could just plug it in to the server if I did).


#9

@brianara3 Ahh ok. In that case, I’m in exactly the same boat as you. After reading your post, I installed Ubuntu Server, and ran the Hassio alternative install (i.e. install on generic linux server) and have connected to my remote device using socat. But like you said, I can’t get Hassio to see my virtualcom0 device.

I just found this on reddit, but I don’t really understand it. Maybe it’s relevant?


#10

Yeah, the --device flag is the issue I’m having. The Linux install launches the Hass docker container from a supervisor container (this is what gives you the ability to live upgrade Hass). But I can’t figure out how to tell the supervisor to launch the Hass container with that flag. On top of that I want to make this change permanent, so it doesn’t get removed by some future docker container update. Using socat I already get the virtual device created at my desired location, but without udev the Hass supervisor won’t mount it by default in the container. Unfortunately I don’t know how to create the udev rules to map the device with socat… Now there are guides for doing this, but you need to know the device/vendor IDs, and all the guides tell you to use “lsusb” for this, but my device doesn’t show up in lsusb’s output.

Though… I wonder if moving my virtual device mapping to the /by-id/… directory might force the mapping as well :thinking:


#11

Has there been any breakthrough in this?? I’m wanting this setup as well and have seen many others wanting it too. I’m stuck at the same place. I can setup the sharing but cannot pass it to my hassio generic install.

Any help is greatly appreciated and I’m happy to help test.


#12

Not to my knowledge.

Surprised that Hass.io, an operating system designed for interacting with your home, doesn’t actually allow you to pass through USB devices automatically… seems like an oversight if I’ve understood correctly

Certainly stops me being able to actually use HA altogether as I don’t want to invest loads of time in traditional version of Home Assistant, would rather have it working in hass.io.


#13

When the USB devices are recognized as serial adapters, like zigbee/zwave, it passes through just fine automatically. Just because they haven’t thought of EVERY possible scenario isn’t a downside, it’s just that it hasn’t been created yet. Why don’t you contribute your needs to the project? Open an issue on Github for it. Get the developers involved and understand what you need.


#14

I played around with 2 different ways of doing this over the past two days (pulling out my hair in the process…) but I did manage to come up with two working options… Socat-to-socat and usbip.

For the Socat version, I used this fork of homeassistant-socat to build a replacement hassio Docker image with socat inside, then trick the Hass.io installer script into using that image instead of pulling the official. The downside is you need to repeat the process every time you want to update Hass. I couldn’t get socat’s simlinked device to register inside the official container.

My final solution was to use the usbip, which was a P.I.T.A. to get working because I’m trying to go from A Aeotec Stick on an RPi3 (fine, no issues) to a Rock Pi 4B which I had to compile usbip from source because it’s such a new board there isn’t a lot of support behind it yet.

It’s working at the moment…