I 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 “127.0.0.1 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 ./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';
I 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.