Z-wave controller made out of a Raspberry Pi and a Aeon Labs Z Stick S2I read an awesome article featuring Conrad Vassallo discussing the progress of his opensource OpenZwave client and server.  He has published a Raspberry Pi disk image based on Rasbian that allows you to write the file to disk and have everything installed and ready to go!

UPDATE: New Image and Instructions

I am very excited about the concept because, honestly, compiling OpenZwave on a Pi is a pain (while the Pi is great – I think most will agree it is not the fastest when it comes to compiling large projects.)

Lights Control Setup

I had a few problems getting the new system up and running but there are a couple of variables other than the image itself that could have caused the problems. I installed it on a new Kingston 8gb class 4 SD card, a “new to me” Raspberry Pi B (version with 256 mb of RAM), and an extra Aeon Labs Z-Stick S2. My initial problem was the system was ridiculously slow. I think this was due in a large part to my SD card not working very well with the older version of Rasbian. This slowness made upgrading my Pi the first priority, but in order to do that I needed to update the IP address which comes statically defined in the image.

A quick note – to do any of the following steps you have to become root by typing “su” and putting in the “lightscontrol” default password.

To get on the network, I edited the “/etc/network/interfaces” file by changing “static” to “dhcp” and commenting out the ip address, netmask and gateway that was defined.

Before rebooting, I decided that I needed a new hostname since I have too many “Raspberry*” devices on the network. I did this by editing the /etc/hosts file to include the line “ lightscontrol” and change the hostname in /etc/hostname to “lightscontrol” as well.

After the reboot, it was update time. As root, I ran “apt-get update && apt-get –y upgrade”. Since I figured it would take a long time, I used the ‘-y’ option and moved on to another project. A very long time later, it was done and actually running a lot quicker.

I wanted the raspi-config utility. So I added the public key for the repository and then added the line “deb http://archive.raspberrypi.org wheezy main” repo to my /etc/apt/sources.list.

wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key
apt-key add raspberrypi.gpg.key

After this was done, I ran “apt-get update” again to get the new list of packages and then installed raspi-config with “apt-get install raspi-config”.

I wanted the raspi-config utility for lazy overclocking and partition resizing. It is not a needed component.

Back to Lights Control install, since I no longer have a static ip address, I want to make sure that I can access my Pi by hostname from any computer or tablet. I made a quick script to do this for me since it is probably the first thing I do on any Pi. You can get it by typing:

wget http://goo.gl/P1ZyC -O addAvahi.sh
chmod +x ./addAvahi.sh

This script will take a few minutes but after it is done you can reboot one last time and feel pretty good about easy access to a headless Raspberry Pi.

Now it is time to check out the LIGHTS CONTROL WEBPAGE! I went to http://lightscontrol.local and a log-in page popped up and I bumped into a little glitch. The username and password in the “hint” did not work for me no matter what combination I tried. I did a little digging and accessed the SQLite database via CLI and updated the tbl_users to have a new username and password (just in case some non-visible character was left behind). The trick seemed to work.

SQLite3 lightscontrol.sqlite
sqlite> update tbl_users set tbl_user_password='lightscontrol', tbl_user_login='Admin';

Lights Control OpenZwave Controller Server and ClientI knew it worked because I was being redirected to another page but the page was timing out and eventually popping up with an error. Not a big deal – the php client was not able to connect to the openZwave server. I took quick look at /var/www/server.php and noticed that the IP address was defined at the top to the old static ip address. I changed the static IP to “localhost” and I was all set.

I haven’t tested it with any Z-wave devices yet because I don’t want to change my current configuration but I have an extra Zwave GE plug coming in Monday.

Props to Conrad for putting this together. The easier and cheaper openZwave is to get set up the better for all of us.

Small Update: add APC with “apt-get install php-apc” and restarted the web server “/etc/init.d/lighttpd restart” and I think I am seeing a little boost in performance navigating from page to page.  My SD card is slow though – mileage may vary.

Light Control Working!

It was a crazy work day today but I did get the new Z-wave GE binary switch in the mail.  I was super excited as I paired it while cooking lunch.  Loaded everything up and hit the web page and I got nothing.  Damn out of time.  Fast forward 10 hours.  It dawns on me that I should check the Z-stick with a copy of my working openZwave server to eliminate the possibility that it was a controller or switch failure (even though I could see the switch in the logs).  I clone my existing setup, plug it in and there was my device.  Well crap.  I knew that Conrad’s server speaks pretty much much the same language as mine and that he had a file called ‘server.php’ that accesses it.  So I connected his client, ‘server.php’, to my server and I was communicating but still nothing showed up under devices.  Advance 15 minutes, after digging through his controllers, I saw the import method and the “import devices” in the right corner of the devices page.  I clicked the ‘import’ button and there it was.  Total user error on my part… just one of those days.

Other Relevant Post


  1. Conrad Vassallo -

    Thanks Thomas for making up this tutorial. The user name was Admin with first letter uppercase and password admin, all lowercase. Any way, glad to see someone using lightscontrol. I wish to find some more time to make it more easier to setup. Let me know how things work when you receive the zwave device.

  2. Jacco -

    Great tutorial, but unfortunatly based on a Pi image I cannot use. Could you tell me how to compile it from source?

    I already have open-zwave and openzwave-cotrolpanel up and running

  3. jacco -

    Hi Thomas, thank you for your quick responds. In the meantime also did some more reading on your website and I have to start with wishing all the best to your family (dog included offcourse). I once lost a dog to cancer, so I kinda know how it feels to go through the process. Hope your story has a happier ending 😉

    I started off by compiling the open-zwave from source:

    svn checkout http://open-zwave.googlecode.com/svn/trunk/ open-zwave (revision 582)
    cd open-zwave/cpp/build/linux/
    sudo apt-get install libudev-dev
    cd ~

    Now I get the socket server (lightcontrol version because github is broken somewhere on my voyage linux)
    svn checkout https://lights-control.googlecode.com/svn/trunk/ light-control (revision 4)
    mv ~/light-control/open-zwave/cpp/examples/linux/server* ~/open-zwave/cpp/examples/linux/server
    cd ~/open-zwave/cpp/examples/linux/server/

    Returned a error 🙁

    Main.cpp:45:26: fatal error: ServerSocket.h: No such file or directory
    compilation terminated.
    make: *** [Main.o] Error 1

    so instead I decided to give it a try via the light control version:
    cd ~/light-control/open-zwave/cpp/build/linux/
    cd ~/light-control/open-zwave/cpp/examples/linux/server/

    which came up with:

    collect2: error: ld returned 1 exit status
    make[1]: *** No rule to make target `Controller’, needed by `../../lib/linux/libopenzwave.a’. Stop.
    make[1]: Leaving directory `/root/light-control/open-zwave/cpp/build/linux’
    make: *** [lib] Error 2

    hmmm, guess I am stuck now….

    • Thomas -

      No problem – I will email you the files. They should go in the same directory. It will take me a couple hours to do a step by step (have meetings this am)

  4. jacco -

    Cool, thank you for the email. No rush, been trying to figure this out for so long now it can wait a bit. I will hold off for the step by step 😉

    By now, “the same folder” can aaply to anything for me. hahaha

    • Thomas -

      Sorry for the delay. You should put the socket email files in the ./open-zwave*/cpp/examples/linux/server and “make”/build the project. Then ./test will run the server.

  5. Jacco -

    Don’t worry about the delay. Not home for a few days but will test it once I am back. Really appreciate your help


Leave a Reply