HA on VM - Remote Z-Wave Stick/Hub

Hi all,

I hope this is an appropriate location for this topic, but I am new to HA as of a month ago. I have it installed on a VBox VM per standard setup instructions. I was having range issues with my Z-wave network with my Z-Wave USB stick plugged into my basement PC, and found this article.

I now have the z-wave USB stick connected to a raspberry pi that I think I have the Remserial program running properly on. Now I’m trying to figure out how to install and run Remserial on my VM with HA so I can access the Z-wave hardware. Is it even possible to access the Linux command line on the VM? I do have a Linux server I use for Plex - I could run HA via Docker there, but I’d rather not if I can do it on my PC.

Thanks everyone!

I’d try OpenZwave if I were you. It’s still in beta but works fine for me and a lot of others already. With OpenZwave the Z-Wave network communicates over MQTT with Home Assistant, so you only need to have an MQTT broker setup somwhere in your network. I use it on a separate pi together with another stick for ZigBee, because my HA machine is in a less than ideal place.

Thanks for the suggestion. Sounds like a better path than I’m on right now. I am currently using the HA MQTT integration as my broker. I will look into this. If there are any good resources for installing/setting up OpenZwave on the pi, I’d be grateful for the direction.

I just recently switched to OpenZWave and wrote a detailed guide on how I set it up but I didn’t upload it to my GitHub page yet. I’ll post it here later when I’m at a workstation.

Please find the guide below, please ignore any typos and let me know in case you have any quesitions.
First check if you stick is supported here.

Setup Z-Wave Hub (Aeotec Z-Stick Gen 5)

The Aeotec stick is attached to the same Raspberry Pi 3 as the ConBee II. We are going to install a software called OZWDaemon inside a docker container. The OZWDaemon acts as a Z-Wave to MQTT bridge.

Install Raspbian Lite on the Raspberry Pi.

Give user access to serial devices to controll the ConBee II stick:

sudo usermod -aG dialout pi
restart

Now we are going to create a Symlink for the stick, this way it doesn’t matter when the device changes the device path (/dev/ttyACM0 instead of /dev/ttyACM1) due to detaching and reattaching the stick or when we add another stick.

Get the product and vendor id of the stick by listing all usb devices:

lsusb

Note the 8 digit number of the stick e.g. 0658:0200

create a file “99-usb-serial.rules” in the folder /etc/udev/rules.d

sudo nano /etc/udev/rules.d/99-usb-serial.rules

Add the following content, where ABCD is the first 4 digits of the previously noted number and 1234 is the last 4 digits.

SUBSYSTEM=="tty", ATTRS{idVendor}=="ABCD", ATTRS{idProduct}=="1234", SYMLINK+="zwave"

Restart.

Install docker and docker-compose:

Docker:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker pi
rm get-docker.sh

Docker-compose:

sudo apt-get install -y python python-pip
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
sudo apt-get install -y libffi-dev libssl-dev
sudo apt-get remove python-configparser
sudo pip3 install docker-compose

Create docker-compose.yml file and directory deconz to store the config:

Create docker-compose.yml file:

sudo nano docker-compose.yml

Add the following content:

version: "3"
services:
  ozwdaemon:
    container_name: ozwdaemon
    devices:
      - /dev/zwave
    environment:
      MQTT_SERVER: ip-of-home-assistant-machine
      MQTT_PORT: 1883
      MQTT_USERNAME: mqtt_username
      MQTT_PASSWORD: your-secret-mqtt-password
      USB_PATH: /dev/zwave
    image: openzwave/ozwdaemon:allinone-latest
    network_mode: host
    restart: unless-stopped
    security_opt:
      - seccomp:unconfined
    volumes:
      - ./ozwdaemon:/opt/ozw/config

This will enable the ozw-admin through port 1983, VNC Server through port 5900 and HTML VNC Client through port 7800.

You can add the following to the environment variables if you want to include devices securely:

OZW_NETWORK_KEY: "network_key"

If you already paired devices securely to your Aeotec stick, put the network key you used to configure the stick in the past.

Configure OpenZWave integration in Home Assistant

In Home Assistant on the sidebar click on “Configuration” then on “Integrations”. Click on the orange plus in the bottom right corner, search for “openzwave” and click on "OpenZWave (Beta).
Hit “Submit”.

If you already had devices paired to the Aeotec stick previously your devices should appear under “Configuration” -> “Integrations” -> “OpenZWave (Beta)”.

To add devices, access the web interface through http://ip-op-the-pi:7800. Click on “Open” in the top left corner. Press “Start” in the bottom box called “Remote OZWDaemon”. Bring the device close to the Aeotec stick for pairing. Click on “Add Node” in the second line at the top. If you want to include the device securely, press “Yes” in the pop-up box, otherwise press “No”. Put the device into pairing mode (For the Aeotec Multisensors I use press on the button at the back, for secure mode press twice extremly fast). Your device should appear under “Node List” if it was successful. Put the device into the final location and press “Heal Network”. Check in Home Assistant if the devices appeared.

The web interface can also be used to change device specific configuration such as motion sensor sensitivity for the Aeotec Multisensor.

1 Like

This is great, thanks! I will have a look at it and give it a try a bit later. I have the Zooz ZST10, so I’m good to go there.

I have a few nodes paired with the stick from when I was hoping it would work directly in my VM - HA has them in the configuration still as well. Would it be best to delete them from the current integration in HA and unpair them from the stick using a PC Z-wave program on a laptop (if that would even work?), or will they still be operational when OZW is up and running? My knowledge of how Z-wave works is less than complete, so I’m not sure how the hub will handle the new network.

The paired devices are stored on the Z-Wave stick, this means all your previously configured devices should show up after installing OpenZwave Daemon. If you paired them securely, you need to use the same network key as you used to pair the devices.

I’m going through your instructions now. I think the line:

sudo apt-get install -y python python-pip

Should be:

sudo apt-get install -y python3 python3-pip

I’m really not sure, but it didn’t work for me exactly as you had it, and I found some instructions that matched pretty closely except that.

I’m more or less able to follow what you’re doing until the docker-compose.yml file. When you say create the file and directory deconz - Is that in the user’s home directory? “~/deconz/docker-compose.yml?”

Within the file, ozw/MQTT port 1883 is pretty obvious, but I’m not sure how I’m getting VNC Server through port 5900 and HTML VNC Client through port 7800. I’m not really sure how to tell if I’ve done any of this correctly, but I do know I’m not finished yet, as I don’t get anywhere on port 7800 of the pi.

Does it matter if I still have the standard Z-wave integration installed in HA? Is the OZW integration standalone, or will I need both in the long run.

Thanks again for the help!

what kind of error did you get? Did it work with the adjusted command?

Oh, I mixed some things up here, deconz is the name of another software running on the same pi, sorry messed this up while copying. Anyway, create a directory called “ozwdaemon” in the home directory, this will be the directory where the database, config etc. for Open ZWave Daemon will be stored once it is up and running. Create the “docker-compose.yml” file also in the home directory not in the “ozwdaemon” directory.

The VNC Server and the HTML VNC client are features of the docker container that this guide installs. After everything is up and running you can connect from a PC with a VNC client to the OpenZWave Daemon over port 5900 or you can connect through a web browser with ip-of-your-pi:7800 which will be a web based VNC Client, meaning you don’t need to have a VNC Client you can just access it through the browser.

You need to stop the currently running Z-Wave network and remove the Z-Wave integration from Home Assistant. You can only run one at a time. You’ll only need the OZW integration.

And I forgot to add, at the end you need to run:

docker-compose up -d

within the home directory, where the docker-compose.yml file is.

Error was something to the extent it didn’t recognize the pip3 command. It did work after the command I pasted in my last post.

I’m definitely making progress, so thanks yet again! I set up the directories as you described and ran the docker-compose command. I removed the original integration before all that as well. At first glance, it looks like it is working. I’m seeing all the same devices I had before, albeit with a few disabled entities. I’ll have to mess around with things and see if I can get the rest of my devices added. Considering my level of (in)competence and the amount of time this took, this was very successful.

A couple last questions:

  1. Will docker run the ozwdaemon container automatically on startup?

  2. I noticed that port 1983 is specified as ozw-admin port on the github page, and the VNC interface shows that port in the “Remote OZWDaemon” prompt. Do I need to at that to my docker-compose.yml? I’ll find out if it works later when I try to add, I guess.

Glad that you made some good progress.

There should be new services in HA to add/remove nodes called “ozw.add_node” and “ozw.remove_node”, which you can use as well.

To your questions:

  1. Yes, it should.
  2. You don’t need to add any ports to the docker compose file because of “network_mode: host”, this means all ports are forwarded to the host.

So I started with HA on a pi4 and added a few devices and then decided I wanted to use my Proxmox server to host a VM for HA and move my Aeotec Gen5 ZWave stick remotely. I decided I’d try the method in this thread. Originally I was using the OpenZwave Integration so I assumed when I moved to this, all my devices would show up the same. However, it appears my motion sensors and recessed door sensors was missing information when I move the ZWave stick to the remote pi.

Any thought on why they aren’t the same?

Edit: Found the answer…the devices were asleep…I had to wake them and they populated the information.

Here is the original devices:

Here is once I moved to the remote pi:

1 Like

for me I needed a sudo for docker-compose up -d

I have a pi set up using your instructions. I see my devices on it when I access it through web VNC.

The part I’m struggling with is what to do in HA. I stopped my normal zwave network, then added the ozw integration. From there what do I do? I also have a MQTT broker running on my HA instance. I see where the pi OZW is connected to the MQTT broker. Is the OZW beta integration supposed to automatically connect to MQTT? Am I missing a step?

I’m not sure I fully underatand. Do you see so.ething on the MQTT broker that is used by home assistant? Did you configure the ip and port correctly in the docker compose file?

I’m having a problem where my connection won’t connect once either my pi4 or my host reboots. I have been able to completely uninstall MQTT from the host and reinstall it and it will work. i’m getting the following in my mqtt logs

1597516100: New connection from 192.168.1.143 on port 1883.
1597516100: Socket error on client <unknown>, disconnecting.
1597516100: New connection from 192.168.1.143 on port 1883.
1597516101: New client connected from 192.168.1.143 as qt-openzwave-1 (p2, c1, k60, u'mqtt15').
1597516103: Client qt-openzwave-1 disconnected.

Yes, I did configure the ip and port as well as the username and password for my MQTT broker in the docker compose file.

In my MQTT broker (The regular MQTT broker in add-ins) logs I can see OZW on the Raspberry connect.

At this point should the zwave devices I have paired to my stick be populated in devices? Should it show in the integrations? Is there any more configuration I should have to do?

If I look at my the integration for OZW beta, no devices are listed there. Are they supposed to?

Are you able to connect VNC Server through port 5900 (I have to use 5901) and HTML VNC Client through port 7800?

From my experience, when mine stays connected, it will auto-populate any devices that are on your Zwave stick and show as devices/entities, including the Zwave stick, in HA.

I’m not sure what I did differently but it all works now. I restored my HA from a snap from before I started working on anything, kept the Pi the way it was since it seemed to be functioning again.

I ensured MQTT was working before I did anything, stopped the zwave integration, then installed the ozw beta integration. Almost immediately it populated my devices. Now I just have to rename everything and I should be set.