Aug 23, 2016

Getting started with Z-Wave

My earlier post went over how to configure the Raspberry Pi for a minimum viable instance of Home Assistant. Since then I’ve gotten a few questions about my specific Z-Wave configuration, so I figured I would write a follow-up on the devices needed, as well as some basic configuration and debugging. My intent is to have some general information about Z-Wave so you can pick and choose the info you need, and isn’t necessarily intended as a chronological tutorial.

Brief Overview

Z-Wave is a brand and protocol owned by Sigma Designs, but various manufacturers can get their products certified for Z-Wave. It is designed for home automation and uses a mesh network between devices to relay data up to a range of about 120 feet.

Since these devices use a different radio frequency than your router to communicate to the controller, they need a hub to which they can send all of their data. Although there are multiple hubs that support Z-Wave, if you are looking to run Home Assistant (which I detailed how to set up from scratch on a Raspberry Pi 3 in a previous post) or openHAB, then the simplest solution may be to use the Z-Stick. This plugs in to the USB port on your controller, and lets it issue commands to the network. Once that’s in place, your devices are ready to use!

What you need to run Z-Wave

Please note that the terminology here is not “canon,” and different manufacturers and websites will use slightly different terms to describe each piece of the home automation puzzle.  I am assuming you are going the open-source route for integration, such as openHAB (Java) and Home Assistant (Python), which means your hardware and software integration options will be separate.  If you buy one of the commercial integration options, then that will most likely provide both the hardware and software in one setup (most likely with “cloud” support as well).

– A Z-Wave hub/controller (such as a Z-Stick).  All the other Z-Wave devices will communicate to this hub (or multiple hubs, if you have more than 232 devices) after being paired/included in the network.
– Hardware integration. This is how the Z-Stick will relay its information for processing and automating. A good example of this is the Raspberry Pi 3 with the Z-Stick plugged into one of the USB ports. Some third-party hubs have the Z-Wave controller built-in, so you’d have only one piece of hardware for both Z-Wave and general functionality.
– Software integration. This is where openHAB and Home Assistant come into play. They support more than just Z-Wave, so you can build your network without being tied to one brand. They provide the UI, rules, and configuration for your devices.
– The Z-Wave devices themselves (light switches, sensors, etc.).
– A client to connect to the software, such as a phone, desktop, or remote.


Before a device can be detected by the network, it has to be paired to the hub. The process for this varies for each device and hub, but since it can be a cumbersome and confusing process, I’ll give one example here, using the Gen5 Z-Stick (hub) and the Z-Wave Plugin On/Off power switch (a device with a single button).
1. The Gen5 Z-Stick has a battery in it, which is great for pairing. Unplug the Z-Stick from the USB port, and bring it to the device you want to add to the network.
2. Press the button on the stick.
3. With the power switch plugged in, press the button on the device now as well. The Z-Stick should flash to indicate that the device has been added.
4. You can press the button on the stick if you are done to turn it off.
5. Plug the stick back into the USB port. Depending on your integration solution, you may need to restart/configure the device, but it should start showing up.

To add multiple devices, repeat step 3 for each one (you should not have to press the button for each new device).

To remove/exclude a device from the network, repeat the steps, but for step 2 hold the button on the hub for three seconds.

Again, the process will vary greatly depending on the device/hub/integration options, but I haven’t encountered a device that deviates from these basic steps too much.

Command Classes

So this is where things get (more?) technical. Each Z-Wave device has something called “command classes” associated with it. These describe which features and capabilities the device has, and often includes the states it tracks. The Z-Wave Alliance site has a good list of most (if not all) of the available devices, and the general information on them. If you plan on doing any development, I would highly recommend it.  Each device has a link to its supported command classes (for example, a thermostat), which gives you a good idea of what you can control on that device, assuming your software supports it. Furthermore, SmartThings has a good write-up on some basic command classes and their uses.

Aside from being a good reference on device abilities, command classes are also useful for development, as they allow for more automation and rules. For example, most devices that use a battery also have a “Battery” command class, allowing you to set up a rule to say, notify you when the battery is low. MiCasaVerde has a list of all the command classes and their flags on a wiki page.  These are useful if you are setting up your own solution to communicate with the device, or if you are adding new capabilities to existing device in something like Home Assistant (for example, here is that thermostat again–note the command class declarations).

OpenZWave Control Panel

OK, if you were only here for a brief overview and I haven’t lost you by now, this is the final hurdle. OpenZWave is a library that allows anyone to connect to the Z-Wave hub. It’s what Home Assistant uses to add its Z-Wave support. OpenZWave also has an open-source control panel that allows you to monitor and configure your devices at a level more granular that I’ve been able to find with other solutions. If you’re wondering if a device is properly reporting its data, or if it has the ability to do “x” function, then I would recommend checking this out first. I was able to find a good tutorial for setup, although I will say that some of the “make” steps took an unexpectedly long time on my Pi, so be patient and don’t panic (please note that version 0.45 of Home Assistant comes with python-openzwave and allows access to a lot of the same functions).  Although the control panel is not necessary to run Z-Wave, I would strongly advise checking it out if you have an interest in adding new features, or if your devices do not seem to be behaving properly.

Hopefully this helps anyone who is interested in the wild west that is home automation right now, but unsure where to start.

Igor Shults

About the Author

Object Partners profile.
Leave a Reply

Your email address will not be published.

Related Blog Posts
Natively Compiled Java on Google App Engine
Google App Engine is a platform-as-a-service product that is marketed as a way to get your applications into the cloud without necessarily knowing all of the infrastructure bits and pieces to do so. Google App […]
Building Better Data Visualization Experiences: Part 2 of 2
If you don't have a Ph.D. in data science, the raw data might be difficult to comprehend. This is where data visualization comes in.
Unleashing Feature Flags onto Kafka Consumers
Feature flags are a tool to strategically enable or disable functionality at runtime. They are often used to drive different user experiences but can also be useful in real-time data systems. In this post, we’ll […]
A security model for developers
Software security is more important than ever, but developing secure applications is more confusing than ever. TLS, mTLS, RBAC, SAML, OAUTH, OWASP, GDPR, SASL, RSA, JWT, cookie, attack vector, DDoS, firewall, VPN, security groups, exploit, […]