Thomas Loughlin

New Open-Zwave Image for Raspberry Pi

For those of you who just want to start playing with the Raspberry Pi and your Z-wave devices, this is pretty much the laziest way. I took the latest Wheezy Rasbian (2012-10-28) image, grabbed all the updates, put nginx, php, and a couple open-zwave clients and servers into a new downloadable disk image. The image will unzip using 7-zip to fit on a 2 gb card but there is not a lot of empty space since I did not remove anything from the default image other than the python_games folder.

How To:

Plug everything in including your Aeon Labs Z-stick S2. (I recommend paring it with at least one Z-wave device before you start up your Pi so you can see the magic from the very start.) The image is already set up to run headless, so you don’t have to plug in your keyboard or monitor unless desired.

Let it boot up. Normally, this goes pretty quick and you can watch the lights blink on the Pi rapidly. I would give it a couple minutes just to be safe.

If you went headless, ssh to [email protected] from any machine on your network. The password is still set to the default ‘raspberry’.

There are two options for starting the open-Zwave socket server depending on what client you want to use. Option 1 was made by Conrad Vassallo and is call Lights Control. It has a nice interface and lots of functionality – I would consider it the “default. The second, is a very basic version made by me without any bells and whistles. To start option 1, type “lightscontrol” on the command line. Option 2 will start if you type “basic”. Both servers cannot run at the same time, but you can switch between them by typing “killOZW” and then the command for whatever server you want to start up.

Then to control your lights, navigate to http://openzwave.local/ (if you are using option 1) or http://openzwave.local/basic/ if you are using option 2. To log in to Lights Control, you will need to type in “Admin” for the username and “admin” for the password (note the case). The first time you load Light Control without any imported devices, it will return an error after you put in the password. To clear up this error, enter “http://openzwave.local/index.php?r=devices” after you have authenticated and click the “import” button. From then on, you should be good to go.

A Few Notes:

The software is very much still under development and this is just a quick start. The security, configuration, permissioning, and future upgrades are up to you but what you have is an almost immediately working open-Zwave solution. I also recommend taking your time between opening and closing the different servers. Every time one of the open-Zwave servers start up, it contacts all the nodes and runs through their status and configuration. As your network grows, this process takes a little longer.

I ran the initial version on a 2gb class 2 SanDisk card and it ran quickly so anything better should have great performance.

UPDATES:

I switch back and forth between the servers a lot and Alison was always checking two urls to turn on the Christmas tree (firstworldproblem).

To fix this, I created a file called “indexbasic.php” and put it in the /usr/share/nginx/www/ directory. It contains the following code:

Yes – I think so – do you have open-zwave compiled in the same structure as open-zwave svn download? What I found is if I took, the files I sent you and Conrad’s Makefile and Main.cpp and put them in a new directory under /cpp/examples/linux/(make a new directory) I could build it without changing the Makefile. (it should solve your “Main.cpp:45:26: fatal error: ServerSocket.h: No such file or directory” problem) I tested it by running ./test and then connecting via telnet (on port 6004). Then I pick a web server (in my case nginx) and installed it and php5, curl, sqlite. When I got it up and running, I got some directory permissions errors – so fix that the horribly insecure way chmod 777 and then got an error because a redirect (change in headers) was being called after text output. I went to whatever line it specified and saw that it was a curl statement outputting the response. I added “curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);” so the return from curl goes to a variable and does not get outputted to the screen.

Hi Thomas,
I installed the image and my raspberry part correctly, but unfortunately does not see my z-stick s2, where am I doing wrong?
I tested my z-stick with a trial version of “homesser” and it works correctly.
Thanks in advance

Hi,
sorry but I made a mistake.
now everything is working and I thank you for your patience.
A small request: I can not run the http server on port 82, I have changed many times the file nginx.conf, but without success.
Any suggestions?
Thank you.

Looks great!!! But while I’m waiting for the image to download I think that I’d really love to play with the code myself and extend it to work with other Zwave devices (like the motion sensor and the energy tracking adaptor). Do you have blogs or other references that give hints about how you came to what you have now?

Hi Andy, are you starting the basic or lightcontrol server before trying to connect via the website? Can you telnet port 6004 (telnet localhost 6004)? If that works try typing in ALIST (then enter). Do any devices return?

Hello,
I would like to build a little home automation box.
I am a beginner so I need some help….
Do you think it’s possible to use :
raspberry-pi + RaZberry + domotiga
to turns Raspberry Pi into Z-Wave Home Controller ?

What do you think of this configuration ? Is it difficult to put in place ?

Hi Thomas,
my question is about – have you succeeded in cross compiling Open Zwave for Raspberry and then cross compiling another C/C++ application again on the Host machine that uses the open zwave library. I can’t cross compile open zwave for Raspi as my Ubuntu complains that I don’t have proper libudev

Not sure what can I do?
P.S. – how is Nunya, hope she’s getting better!

I have only compiled open-zwave/server/client/control panel on the Pi. Your timing was actually perfect as the comment came in right as I finally got my server to compile with the latest openzwave on a fresh install. I plan on releasing a new img tomorrow.

What version of ubuntu are you working on? Do you show both libudev-dev and libudev0:armhf? I am also assuming that you are using openzwave rv 628.

Hi Thomas, I also have a cute little doggy waiting to me to go back home in the evening so I’m glad Nunya is getting well 🙂

Great that you’re releasing a new img soon! I’ll try to recompile everything on the Pi but it would be great to make the cross compilation work too as it would be so much faster.
I’m having Ubuntu 12.4 and the latest openzwave source code. I think I don’t have libudev0:armhf. Apt-cache search doesn’t have it – I have only libudev0 and liudev-dev and they are currently installed. Do you know where should I get it from, may be it’s a part of another package… I’m now trying to find the libudev source, so that I can cross compile it for the Pi by myself. Hope it works! and all the best 🙂

I sent the other usb device I was using above back, it was faulty. I now have a aeon. I can see the devices in basic and switch them on, but then not off.
in lightscontrol I clicked import and now get the error below?

In lightscontrol I get the php error above on the devices page and control page, so don’t see the website.

Basic works, but won’t switch the lights off, only on

justin -
February 26, 2013 at 10:45 am

I have a z-stick 2 paired with a single dimmer switch. Both basic and lightscontrol show three devices. Static Controller, Routing Binary Sensor and Multilevel Power Switch. In lightscontrol I am able to toggle the Multilevel Power Switch on and off. I don’t know what the other two devices do. In Basic the other two devices are represented by light bulbs and have a status but the Multilevel Power Switch has a broken link image and no status. When I click on it, nothing happens and I get the message “Last MSG: MSG~ZWave Node=4 Level=255” every time. Any idea whats going on?

Thanks for the images. After a little initial trouble changing everything to listen to /dev/ttyUSB1 instead of USB0, it seems to be working… now I just have to wait for my actual first Z-Wave device so I can properly test it. 🙂

Actually we plan to have several things running on the PI; Z-wave, ZigBee, WiFi, BT and serial communication to wired standards like KNX and M-Bus to smart meters..So on top of the IP stack we are planning a layer across different standards to be joined into JSON sripcts, pretty much like the SMARTTHINGS project.

A first major step would be having your openzwave up and running, and then secondly to combine it with the piggy back board as well. So if you have a basic image working with openzwave we would have one Pi running with that first, or do you have an idea of the best way forward… ?

and i’m getting the same error as Andy above when i run ./basic-server: ERROR: Dropping command, expected response not received after 3 attempt(s)

When i try to “import devices” i get a device with device name “error Connection Refused”. I can’t telnet into the device, and even after i reset it i still can’t do anything. i have paired the usb stick with a device and still it’s a no go. what am i doing wrong? ANDY WHERE ARE YOU?!?!? DID YOU EVER FIX THIS?!?!?!

i kept getting the “error Connection Refused” when trying to import the devices on conrad’s client (using the lightscontrol server). so i rebooted, and ran ./basic-server from /open-zwave-read-only/cpp/examples/linux/testserv. this spits out basically the same log as Andy, although sometimes i get a “Expected reply was received”. and yeah i’m using the z-stick 2 and /dev/ttyUSB0 (i checked /dev/ and ttyUSB0 exists).

I also tried rebooting, not starting any servers, then running the openzwave control panel and initializing /dev/ttyUSB0. it will spit out the same log as ./basic-server, and when i try to reset the device it gives me this error: “mgr, Manager::GetDriver failed – Home ID 0x00000000 is unknown ozwcp: ../../src/Manager.cpp:320: OpenZWave::Driver* OpenZWave::Manager::GetDriver(uint32): Assertion `0′ failed.”

so i got it to work eventually. dont really know how. i tried running the reset function from openzwavecontrolpanel and then re-paired my device to the usb stick. i was then able to import my device without getting the “error Connection Refused” device showing up. thanks for the help!

The interface works great! I do, however have a question – one of my z-wave modules is a water sensor. Is there a way to treat it as an input device, rather than associate on/off functionality with it?

Hi Thomas — Thanks for putting together this great package!! It got me up and running amazingly quickly. I am having an issue with the lightscontrol scheduler and was wondering if you had any tips on troubleshooting? I have a simple binary light that I am trying to get to turn on in the evenings. NTP looks good and date is reporting the correct time. I tried deleting the schedule and readding. The light turns on and off using the lightcontrol software and hitting the buttons manually just not with the scheduler.

Looks like it has been a while on comments on this project, but I am just now getting into the zwave stuff and have a small problem. I got everything loaded up on my raspberry pi, started up the ./ozwcpPI -p 55555, brought up the browser, entered my com port and initialized it. My devices start to show up, but with no manufacturer names. Looking at the log, its says “unable to load manufacturer_specific.xml.” I see that file in the “read-only/config” directory, but not in the other config directory. Is it supposed to be there as well ?