Programming Z-Wave

October 21st, 2008

As a developer one of the main reasons for going with Z-Wave was to try out some software product ideas I had around controlling Z-Wave.

There is a standard C-language Z-Wave Development Kit, however it costs at least US$1,500.00, which is way beyond what most hobbyists/bootstrapping startups would be willing to pay.

The main alternative is currently the ControlThink SDK, which is a .NET based API.  It costs around US$70, which is much more affordable.

The ControlThink PC SDK comes with a USB Z-Wave controller, which works for North America.  Of course if you are based in Europe (as I am) then this USB device will be useless.

I have however managed to get the ControlThink SDK working with the ACT ZCU201 USB controller on Vista.

There is an XP driver available for download here on the ACT web site.

For Vista however, I followed the instructions in this thread in order to use the driver for the Intermatic controller, which I assume uses the same underlying chipset.

I downloaded the ha22vista2.zip file from http://board.homeseer.com/showthread.php?t=121133&referrerid=55149 then I edited the DriverSetupForVista\DriverSetupForVista32\SPC825.inf file and replaced the existing [Sunplus] section:

[Manufacturer]
%Sunplus%=Sunplus

[Sunplus]
%DeviceDesc%=ComPort, USB\VID_04FC&PID_0204

[DestinationDirs]
ComPort.NT.Copy=12

with:

[Manufacturer]
%Sunplus%=Sunplus

[Sunplus]
%DeviceDesc%=ComPort, USB\VID_04FC&PID_0204
%DeviceDesc%=ComPort, USB\VID_04FC&PID_0003
%DeviceDesc%=ComPort, USB\VID_04FC&PID_0201

[DestinationDirs]
ComPort.NT.Copy=12

I then right-clicked on the SPC825.inf file and clicked Install.  Once it installed properly I rebooted (IMPORTANT!).

After rebooting I went to the device manager and saw that the USB driver was installed as COM port 4 (it may be different in your case):

image

Having installed it, I was ready to write my first program.  I created a new Console Application project, added a reference to the ControlThink assembly (in my case under C:\Program Files\ControlThink\Z-Wave PC SDK\Bin\.NET Framework 2.0\ControlThink.ZWave.dll)

I change the main program to look like this (note the use of COM4 matching the port in the device manager above):

using System;
using ControlThink.ZWave;
using ControlThink.ZWave.Devices;

namespace ZWaveTest {
    class Program {
        static void Main(string[] args) {
            ZWaveController controller = new ZWaveController();
            controller.Connected += ControllerConnected;
            controller.Connect("COM4");

            Console.ReadLine();

            controller.Disconnect();
        }

        private static void ControllerConnected(object sender, EventArgs e) {
            ZWaveController controller = (ZWaveController)sender;
            foreach (var controllerDevice in controller.Devices) {
                ZWaveDevice zwaveDevice = (ZWaveDevice)controllerDevice;
                Console.WriteLine("Found device with ID = {0} and type {1}",
                                                     zwaveDevice.NodeID,
                                                     zwaveDevice.GetType());
            }
        }
    }
}

This is the result when I ran the program:

image

Frankly I’d much rather have access to the lower-level API — there are things that I can’t do with the ControlThink API that I can’t help but wonder if I might be able to do with the proper Zensys C SDK, but at over $1.5K I guess I’ll have to make do!

7 Responses to “Programming Z-Wave”

  1. Federico Says:

    Hi, I’m an italian student…Why USB Z-Wave is useless in Europe?

    Can you reply with an email, please?

    Cheers
    Federico

  2. damian Says:

    Hi Frederico,

    Z-Wave devices are different for Europe and the US (they use different frequencies), so US devices are useless in Europe — Z-Wave itself isn’t useless in Europe.

    /Damian

  3. Max Says:

    Hi, i’m Max from Malaysia. I would like to know is it possible if I use ( ZIR010 - Z-Wave Motion Sensor, Euro ) in my country area? ( Malaysia )

  4. damian Says:

    Hi Max,

    I am not sure which device should be used in Malaysia — different parts of the world use different frequencies:

    “Frequency band: The Z-Wave Radio uses the 900 MHz ISM band: 908.42MHz (USA); 868.42MHz (Europe); 919.82MHz (Hong Kong); 921.42MHz (Australia/New Zealand).”

    From: http://en.wikipedia.org/wiki/Z-Wave

    /Damian

  5. Leslie Says:

    Dear Damian,

    My brother and are also software developers. We would like to develop maintenance and monitoring software for Z-Wave tools.

    We don’t want to buy any hardware tools, or Z-Wave tool developer kit’s, we don’t want to develop embedded software for Z-Wave chip. We just would like to develop PC software for Z-Wave tools.

    Unfortunately it is very hard to gather any information about this kind of development.

    I read about the ControlThink SDK for an affordable price, but they don’t ship to Europe even it is a .NET SDK. I read also about DigiKey’s Software Developer’s Kit but it’s a “bit” expensive.

    I thought you could help us out with this. Have you met any other Software Dev Kits for an affordable price? Or do you have any good advise where should we start?

    Thank you in advance.

    Best regards,
    Leslie

  6. Glen Says:

    Hey Damien — what kids of things did you find not possible with the ControlThink SDK? I’m considering buying it..

    thx.

    /glen

  7. damian Says:

    Hi Glen,

    I had expected to be able to receive immediate notification when a Z-Wave light switch was flipped, but instead you have to rely on polling. Not sure if this is a restriction of the kit, or the underlying Z-Wave protocols.

    You can subscribed to be notified immediately when a motion detector detects movement, however if you also subscribe to be notified when the motion detector’s battery is running low, then you have no way to distinguish the two events.

    Its been some time since I played with it, so there may be other things. I’ve just started developing a little again, this time using Windows 7, which works well so far.

    Regards,
    Damian

Leave a Reply