Time to cook: 120min
Difficulty: +++++
Z-Wave is a wireless communications protocol used primarily for home automation. It is a mesh network using low-energy radio waves to communicate from device to device, allowing for wireless monitoring and control of residential appliances and other devices, such as lighting control, security systems, thermostats, windows, locks, etc...
The Smart HUB we built in the first recipe is able to support Z-wave devices.
Actually one of the most popular bindings used on the Smart Home HUB is for no doubt the Zwave binding.
Ingredients
Aeon Zwave Stick
Fibaro Wall Plug
Prerequisites
Execute the Smart HUB recipe
Tools
Nihil
The Building Plan
The mesh network is managed by a Z-Wave controller. In this recipe we are going to use an Aeon Z-wave stick to connect to our Smart HUB via USB, but you can use another type of Z-wave controller for your project.
Adding Z-wave to openHAB
First we are going to add the Zwave binding on the Smart Home HUB. The PaperUI tool which is available on the welcome page of your openHAB installation allows you to configure your openHAB environment, including adding all kinds of bindings.
Open Paper UI
Select Add-ons from the left menu
Select Bindings from the top menu
Search or scroll down for the Zwave Binding (binding-zwave - 2.5.0.SNAPSHOT)
Click Install
More information about the Zwave binding can be found here
https://www.openhab.org/addons/bindings/zwave/
After installing the Zwave Binding, we need to configure the Zwave Binding:
Click on Configuration → Things in the left menu of Paper UI
Click the + sign in the Inbox
Select Z-wave
The AEON Zwave serial controller should be auto-detected
Add it as a ‘Thing’ and edit the configuration.
Select the USB port on which the Aeon Zwave Stick is mounted
If everything went well, the Z-wave Serial Controller should come ONLINE as shown in the following image:
⚠️ It is important to select the correct USB port. This is the port on which the Zwave controller is connected. In my setup this is /dev/ttyACM0. Remember we are running linux. If you are not sure which port to look for, login into your RPI using an SSH connection and go to the /dev folder. List all ports using the command line instruction:
cd /dev sudo ls -all
Then plug the Z-wave controller in one of the USB ports on your RPI and re-run the command line instruction. Compare both lists and you should be able to find the port on which the Z-wave controller is attached.
Including your first Zwave Device
We are now ready to add our first Zwave Device. As an example we will add a Fibaro Wall Plug. This is a nice looking connected wall Plug which we can switch on and off is also capable of measuring the energy consumption. An led ring can be used to visualize the device state like on/off or change the color depending on the power consumption.
Zwave includes an autodiscover protocol. When you set the Z-wave controller we have previously configured in inclusion mode, it can discover new Z-wave devices. The same process can be used to exclude a Zwave device.
Click on Configuration → Things in the left menu of Paper UI
Click the + sign in the Inbox
-
Select Z-wave → (This will put the Zwave controller in inclusion mode)
Plug the device into a socket nearby the main Z-Wave controller.
Quickly, triple click the B-button located on the casing.
Wait for the adding process to end.
A new Z-Wave node will appear in the openHAB inbox. openHAB includes a large set of pre-configured Zwave devices in it’s database. The Fibaro Zwave wall plug is one of them. It will recognize the Zwave device and the new Z-wave node will present itself as a Fibaro wall plug including all pre-configured channels (channels can be seen as device assets, a collection of sensors and actuators).
You can now add the newly discovered Z-wave node as a ‘Thing’ to your configuration. The result could look like this:
The list above shows all the channels that have been discovered under the Z-wave wall plug. The first channel is the actual actuator which turns the Z-wave wall switch on or off. The second, 3rd and 4th report the power consumption.
You can control your Things from within openHAB paperUI. Go to Control in the left menu and you will find an overview of all your ‘Things’ for which you have channels. For the Z-wave wall plug described above the UI looks as follows.
When you toggle the switch button, the wall plug will be turned on/off. The sensor (power) and Electric meter will report the power consumption.
This interface is nice for testing out your devices and a first impression. In the Cookbook you will find other ways to build user interfaces or use for example Alexa to control your wall plug!
}
}
Commentaires