Skip to main content

Installing AeonLabs Z-Wave Stick on a Raspberry Pi openHAB server

Background

This guide is for  installing an AeonLabs Z-Wave Stick Gen5 usb stick on a a Raspberry Pi and integrating it into the openHAB home automation server for controlling Z-Wave devices.

Steps

  1. Install Z-Stick on Raspberry Pi USB port - powered hub is desired
  2. The Z-Wave Stick is automatically detected without additional software installation. Correct detection of the USB stick can be verfied with the lsusb command:
    pi@raspberrypi /usr/share/openhab $ lsusb
    Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 001 Device 008: ID 0658:0200 Sigma Designs, Inc.Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUBBus 001 Device 005: ID 045e:00f5 Microsoft Corp. LifeCam VX-3000Bus 001 Device 006: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
    The “Sigma Designs, Inc.” device is the Z-Wave USB stick.
  3. Now we need to find out on which path the USB stick is mounted. Using the dmesg command right after the USB stick has been plugged in should show the detection of a new USB device. The highlighted text of the output is important for us:
    [38617.742571] usb 1-1.3.2.3: new full-speed USB device number 8 using dwc_otg[38617.846416] usb 1-1.3.2.3: New USB device found, idVendor=0658, idProduct=0200[38617.846458] usb 1-1.3.2.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0[38617.854496] cdc_acm 1-1.3.2.3:1.0: This device cannot do calls on its own. It is not a modem.[38617.854648] cdc_acm 1-1.3.2.3:1.0: ttyACM0: USB ACM device
  4. The configuration in openHAB itself is simple. We just have the define the mounted path in the Z-Wave binding section of the openhab.cfg:

    zwave:port=/dev/ttyACM0
  5. OpenHAB doesn’t have a configuration utility for Z-Wave, so you need to install another web management tool which does – HABmin. Download the current release at the HABmin Github repository (Download ZIP buton)
  6. Once you’ve unzipped it, you’ll find 2 .jar files in the addons directory – these should placed in the corresponding addons directory in your OpenHAB Home share (if you’re also using the Aotec Z-Stick Gen5 , make sure the the Z-Wave binding version is 1.8 or higher).
  7. Ensure that the permissions are set for habmin to access these add-ons:

    sudo chmod -R 555 /usr/share/openhab/addons
    and
    sudo chown openhab:openhab /usr/share/openhab/addons/
    sudo chown openhab:openhab /usr/share/openhab/addons/
  8. Next, create a new folder in the webapps directory /usr/share/openhab/webapps, and called it “habmin” (lowercase is important). 
  9. Copy the rest of the downloaded files into there.
  10. Change ownership of the habmin directory to openhab user:

    sudo chown -R openhab:openhab 
    /usr/share/openhab/webapps/habmin
  11. Allow the OpenHAB user to access the modem. This is only necessary if your controller is coming up as /dev/ttyACM0, not /dev/ttyUSB*
    sudo usermod -a -G dialout openhab
  12. Now, to kick everything into action, restart OpenHAB:sudo service openhab restart
  13. Wait for 5 minutes then open habmin:
    http://192.168.178.20:8080/habmin/index.html
  14. Open the Configuration Tab and select the Bindings group
  15. Select the Z-Wave binding
  16. In the right panel under the Properties tab set the following:
    Port = 
    /dev/ttyACM0 (should already be populated from openhab.cfg setting)
    Heal Time = 2
    Enable SUC Mode =
    Enable soft reset = false
    OpenHAB is Master = true
  17. Under the Devices tab the Z-Wave Stick Controller should be listed
  18. Click on Include to make the Stick search for other Z-Wave nodes, the stick will look for nodes for 30 seconds.
  19. Press the Action button on the Multisensor briefly, it will then announce itself to the Stick.
  20. The Sensor should then appear underneath the Stick.


              Comments

              Popular posts from this blog

              Setting up NUT on a Raspberry Pi for Greencell USB UPS

                Background This article provides a guide for installing a USB UPS attached to a Raspberry Pi. In my case I had purchased a GreenCell 600 360W USB UPS. Integrating the USB UPS requires using NUT (Network UPS Tools). This UPS uses the blazer_usb driver. Installation NUT Plug-In the UPS USB-Connection to the host. My device showed up as Device 006 below: # lsusb   Bus 001 Device 006: ID 0001:0000 Fry's Electronics MEC0003 Bus 001 Device 005: ID 0bda:0309 Realtek Semiconductor Corp. USB3.0-CRW Bus 001 Device 004: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub Install the NUT package with the apt package manager:   sudo apt-get install nut Make some configurations and changes in the nut directory /etc/nut: # cd /etc/nut drwxr-xr-x 2  root nut  4096   Jan 11 00:49 .

              Sending SMS Messages from openHAB

              Background So I setup sending SMS messages from my Raspberry Pi (see article I wrote here ) and have a bash script to automate this. The next step is to integrate this into my openHAB server, so I can send SMS messages to my mobile phone when my UPS system (managed by openHAB) is on battery power (e.g. due to a mains network failure). Installing the EXEC Binding to openHAB See here . Note especially the requirement to add commands to the whitelist. Adding a Thing to openHAB Once the EXEC binding is installed the next step is to setup a thing file to use the binding for sending bash shell commands:  $ nano /etc/openhab/things/exec.things Add the following line: Thing exec:command:sendsms [ command="/usr/local/bin/sendsms.sh %2$s", autorun=true, interval=0 ] Save the file. As you can see this thing is used to pass the command to run the bash shell script to send an SMS and pass the text sent as "%2$s" to the script. Adding Items to openHAB Two items are required, one

              SMS messaging on Raspberry Pi with Gammu

              Background Ever wanted to be alerted when the power fails at home? I typically worry that food in the freezer will go off when I am on vacation! (Yep, that's how I tick). I have recently installed a UPS system which I use to protect various IT and network devices from instant power loss, enabling them to shutdown gracefully. This is particulary important for my Raspberry Pi (Pi) devices, which are sensitive to this issue, as SD-Cards can be corrupted and then not re-boot.  The UPS I have installed interfaces via USB with my Raspberry Pi server using the Linux Network UPS tools NUT so that I can monitor status changes (e.g. grid power loss) and this is further integrated into my openHAB -based home automation system. This setup will be covered in another post.  I wanted to additionally be alerted when grid power fails via SMS to my mobile phone. To do this I have purchased a pre-owned USB Internet Surf Stick and a pay-as-you-go SIM card (zero cost) which I can load with credit. I a