This article is more than 1 year old

How to get a Raspberry Pi to take over your Robot House

Mouthwatering nerdy possibilities - use ANY gadget to bring darkness or light

At last, the ability to turn stuff on and off no matter what gadget I happen to be holding at the time

That was nice, but not quite what we were after, so we delved into the JSON interface for device control. There's a cut-down version of the Z-Way client which comes with HTML and JavaScript source code and one can stick it in a browser and see how it works. The interface just asks the IP address of the Raspberry Pi concerned and kicks off a JavaScript client which one can muck about with to find the commands being sent - in our limited experience this worked better than using the manual, and established that we could turn on our light by loading the URL:

http://192.168.1.75:8083/ZWaveAPI/Run/devices[2].instances[0].commandclasses[37].Set(255)

... which returns a null but also switches on the light. Replacing the last number with zero switches it off again and we have a mains switch we can control from any app capable of opening a socket and sending a String.

A device

Less successful was the Keyfob. Including it seemed a very hit-and-miss affair, and we never managed to exclude it at all. But once included the fob worked as promised - we were able to link it up to the mains switch for remote controlled lights - however the manual proved fiddly and control over the flexible arrangement of buttons (which can be double or single tapped, and toggle or be absolute) was far from intuitive.

We did eventually get it "wired" to the switch, and it even worked when the Raspberry Pi was powered down. Z-Wave devices can be instructed to work together, but without the Pi to route the communications it did take up to six seconds for the button push to trigger the switch - not what one would want at the top of the basement stairs. When the Pi was running the same instruction took less than a second, which seems worthwhile.

The meshed nature of Z-Wave means each node is also a relay, allowing every corner of the home to be reached, and the Z-Way interface provides a live table of which devices are speaking directly to each other which is fascinating in itself.

What we really wanted, of course, was to tie the keyfob buttons into our Raspberry Pi music system. Buttons one and three would switch the amplifier on and off, while buttons two and four would start and pause payback, reducing the need to boot up a web browser every time one wants to pause the music (worktop touch-controls not withstanding). But sadly it wasn't to be.

The Z-Way application is all written in C, and while Z-Wave Europe can provide APIs there's no easy way to hitch it to a Python app like our music player. Apparently there was a Python version, but it couldn't achieve the performance necessary to maintain Z-Wave compatibility, which indicates that a second Raspberry Pi is probably in order to keep the music playback smooth.

Sadly catching keyfob actions over the JSON interface isn't possible with this version of Z-Way, so the two-Pi solution is also out for the moment at least. A new version of Z-Way is promised within a few weeks, along with better documentation and and an "automation engine" to facilitate triggered actions.

El Reg readers will likely be more interested in the JSON interface and ability to hook a controlling Pi to a home network capable of managing thermostats, heaters, motion detectors and door locks, rather than an automation engine providing drag-and-drop controls of existing devices. For that the next version of Z-Way looks very exciting, but the existing product still provides a fun introduction to Z-Wave and could make some of those Pi's sitting in cupboards and corners a little more productive. ®

More about

More about

More about

TIP US OFF

Send us news


Other stories you might like