Author: Praveen M Nair Mail: praveen.nair@icloud.com
Open source z-wave library for home automation
I have the following
- aeon z-stick
- raspberry pi: hosts the backend to control my z-wave devices and a simple web interface over lighttpd to interact with the backend.
There are 3 parts here
- zwave_lib: A simple zwave protocol library with its own test code.
- hzremote: The remote daemon that uses the zwave protocol library and provides an XML-RPC interface to control your zwave module I have an aeon z-stick that acts as my gateway to all my z-wave enabled devices
- www: A simple web interface written in PHP and JS. This web interface talks to my backend using the XML-RPC interface I host it on a lighttpd server
-
Create web location that the server will use in /var - sudo mkdir /var/www - sudo groupadd www-data - sudo adduser www-data www-data - sudo usermod -a -G www-data www-data - sudo chown -R www-data:www-data /var/www
-
Install lighttpd - sudo apt-get update - sudo apt-get install lighttpd
-
Install php5 - sudo apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-fpm php5-cgi php5-cli php5-common
-
Setup lighttpd Create following symlinks from /etc/lighttpd/conf-available to /etc/lighttpd/conf-enabled - 10-accesslog.conf - OPTIONAL - 10-cgi-php.conf
- 10-fastcgi.conf
- 15-fastcgi-php.conf
- 15-fatcgi-php.conf - 10-proxy.conf - For routing requests to XMLRPC server -
Add the following in 10-proxy.conf
proxy.debug = 1 $HTTP["url"] =~ "^/RPC2" { proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 8080 ) ) ) }
-
Install raspbian wheezy on the raspberry pi You can follow the detailed notes from http://elinux.org/RPi_Easy_SD_Card_Setup
-
Install necessary tools and libraries - sudo apt-get install build-essential make git - sudo apt-get install libsqlite3-dev libxmlrpc-c3-dev
-
Fetch the latest source code - cd /opt - git clone http://github.com/pmnair/zwave-remote
-
Compile the library - cd /opt/zwave-remote/ - mkdir bin - mkdir lib - cd zwave_lib - make clean all - cd ../hzremote - make clean all
-
Deploy the web interface - sudo cp -a /opt/zwave-remote/www/* /var/www/ - sudo service lighttpd restart
-
Start the control app - /opt/zwave-remote/bin/hzremote --daemon NOTE: to automatically launch the service add the above line to /etc/rc.local
-
From another machine on the network launch a browser and enter the following address http:///hzr.php
NOTE: Drop me a mail if you face issues with any of the instructions above; comments, improvements code enhancements are all welcome.