C# Code Example:

 

/* Author: David Powell

     Date: January 09, 2008

     Notes: This source code depends on the www.controlthink.com PC SDK DLL from.

     Hardware: This code requires a USB Controller but could be edited for a serial controller

*/

 

 

 

 

//Create a new controller object

ControlThink.ZWave.ZWaveController ZC = new ZWaveController();

 

//ReplicationGroups one or more ReplicationGroup objects

//Note Array must not include null indexes

ZWaveController.ReplicationGroup[] ReplicationGroups = new

    ZWaveController.ReplicationGroup[1];

ZWaveController.ReplicationGroup GroupXX;

 

//Required objects for ZC.AddController

ZWaveController.ReplicationScene[] RSs =

    new ZWaveController.ReplicationScene[1];

ZWaveController.ReplicationScene RS =

    new ZWaveController.ReplicationScene(1);

 

byte GroupID = 1;  //Byte from 1 to 64

byte NodeID; = 52; //Byte from 1 to 232

 

//Connect to the USB Controller

ZC.Connect();

 

//Required for ZC.AddController

RS.SceneItems.Add(ZC.Devices.GetByNodeID(NodeID), 255);

RSs[0] = RS;

 

//GroupID is the group number with the max being 64 groups

GroupXX = new ZWaveController.ReplicationGroup(GroupID);

 

//Get a device object by using the NodeID

//Add that device to ReplicationGroup GroupXX

GroupXX.Devices.Add(ZC.Devices.GetByNodeID(NodeID));

 

//Add GroupXX to ReplicationGroups array.

ReplicationGroups[0] = GroupXX;

 

//Start Replication

//After this line is executed you must put the

//Elk Z-Wave Interface in programming mode

//See Z-Wave Interface instructions for details

ZC.AddController(ReplicationGroups, RSs);