Z-Wave is a wireless communications protocol used primarily for Home Automation. It can be a bit harder to work with compared to some other protocols we see daily like WiFi and Bluetooth. Ever since I got my USB Z-Wave gateway and first dimmer switch, I’ve been interested in Z-Wave and see the benefits of a completely local mesh network for Home Automation communication. I’ve assembled a few tips and tricks that can help improve your Z-Wave experience using Home Assistant.
Some of these will work with other Home Automation platforms, but these are what I use for Home Assistant.
Accessing Device by ID
I use a USB Z-Wave gateway to communicate with my Z-Wave network from Home Assistant. After a reboot of my server, sometimes my USB stick changes from
/dev/ttyACM1. This can be really frustrating because Home Assistant will startup but not be able to access my Z-Wave Network.
An easy way to solve this problem is to change how you are referencing the USB stick in Home Assistant (or any other application). I’m going to be using Z-Wave as an example here, but really anything applies that tries to access a USB device over a path.
In a typical Z-Wave configuration file in Home Assistant you may see something like:
While this works, the path to the USB device (
/dev/ttyACM0) is hardcoded into the configuration.
What you might not know, is there is another path to your USB device that doesn’t change between reboots. If you run:
ls -la /dev/serial/by-id
You should see a list of files described by their IDs and what tty devices they link to. You can actually use these paths in your Home Assistant configuration and they won’t change over reboot. So in my case, I can change my Z-Wave configuration to use this ID based file.
Or if you’re using Docker compose you can mount the device into your container using this serial by id path. You can mount the device to a consistent path (in my case
/dev/zwave) and then use that path in your Home Assistant configuration.
Add a Z-Wave Network Graph
Ever want to visualize how your Z-Wave network is laid out? The resourceful users in the Home Assistant forums have come up with a custom panel to add to Home Assistant to visualize your graph.
First, you’ll need to download the HTML file containing the code to render the graph. You can download the
zwavegraph2.html file from GitHub.
To load the HTML file, we can use the panel_custom integration. Create a “panels” directory and place the downloaded HTML inside. Then, add the following to your top-level Home Assistant configuration.
- name: zwavegraph2
sidebar_title: Z-Wave Graph
Restart Home Assistant and you should see a “Z-Wave Graph” icon on your configuration sidebar.
This is really applicable to any Z-Wave network but wanted to talk about a few solutions. As you may know, having your Z-Wave Hub in the most central place in your house greatly improves the Z-Wave performance. This is because all the other Z-Wave devices can make fewer hops to communicate with the hub, resulting in less latency. But if you’re like me and running Home Assistant with a USB Z-Wave gateway your USB stick will be sitting wherever the machine running Home Assistant sits. In my case, it’s plugged into a PC sitting in my office, which is not central to my house.
To combat this, you have a few options. First off, you can get a long USB cord. There are even active USB cords that go up to 30 feet. If you’re running Home Assistant on a server in a rack, even moving the USB stick a few feet away can greatly improve the performance, due to the signal noise caused by a server.
Another option is running the USB stick on a dedicated Raspberry Pi that you can place centrally in your house. You can then expose the USB port over your local network connection back to the server running Home Assistant. I wrote an article about this (Remote USB Z-Wave Controller over TCP) using the remserial program. But there are other alternatives to remserial as well (SOCAT is popular). Below shows the network topology for this implementation.
Finally, you could have a dedicated Raspberry Pi with the USB controller running in a central location but expose the Z-Wave devices over MQTT. There is an OpenZWave to MQTT project that allows you to run a Docker container to map the devices from Z-Wave to MQTT. This way your Home Assistant instance will just use MQTT to control the devices and your Z-Wave hub will still remain in a central location.
Adding Custom Devices
Unfortunately, the version of OpenZWave present in Home Assistant can sometimes lag behind what is released in the OpenZWave GitHub repository. The OpenZWave repository has a
config directory that is broken down by vendor, so you should be able to see what devices are supported. If the device you are looking to add is not supported in Home Assistant but is found in the OpenZWave GitHub repository you still have some options.
To use the newer device configuration we can use the Z-Wave integration option config_path.
Start by downloading the latest version of OpenZWave from their GitHub repository. Once that is downloaded and extracted you need to add it into your Home Assistant environment. This will be a little different depending on how you installed Home Assistant. For me, I use a Docker container for Home Assistant so I copy the OpenZWave config directory contents into my configuration directory and name the directory
openzwave_config. Note that you only need the
config directory from OpenZwave not the rest of the repository.
Then in your Z-Wave configuration within Home Assistant you can set the custom config_path. This allows Home Assistant to use the latest devices added to the GitHub repository.
Disable Auto Heal
When reading through the Home Assistant Z-Wave documentation you may come across an option called autoheal. While I first this sounds like a great idea, it actually can be detrimental to your Z-Wave network. Essentially having the Z-Wave network autoheal every night causes nodes to forget the most stable paths in your network. Check out the full discussion on GitHub for more background.
Thankfully, this is no longer the default behavior. But if you’re like me and setup Z-Wave awhile ago you might have seen that option and set it to True thinking you would be improving performance. Definitely reevaluate if you need this.
Z-Wave can be a great technology once you’ve learned a bit about it and set it up correctly for your home. I really like that it is a completely local network protocol so you’ll never depend on any cloud services as well as its mesh network topology so it only improves the more devices you have. Using these easy tips you can hopefully improve your Home Assistant Z-Wave setup.
If you liked this article, you may be interested in some of my other Z-Wave related articles.
- Convert Your Pull-Chain Ceiling Fan to Z-Wave
- Zooz ZEN22 Z-Wave Dimmer Switch Review
- Zooz ZSE29 Z-Wave Outdoor Motion Sensor Review
If you found this tutorial helpful, please consider supporting the blog by joining my mailing list, following the blog on social media or directly through Buy Me a Coffee. Thanks for reading!