Skip to content

How to control devices

Markus edited this page Jul 10, 2019 · 1 revision

In this article you will learn how to control zigbee devices with ZigBeeNet.

We have almost all ZigBeeClusters implemented by generating code with the autocode generator and a cluster definition file which is based on the official documents

You can use them to control your devices as you like or need.

You need to get the node and endpoint adress for sending a command to a node. Here an article how to do this: Get node and endpoint addess

Here is an example to turn a light on or off and set brightness level

// Get endpoint address
var endpointAddress = endpoint.GetEndpointAddress();

// Create a command object
OnCommand onCmd = new OnCommand();

// Send command via network manager
await networkManager.Send(endpointAddress, onCmd);

// Create a command object with parameters
var command = new MoveToLevelWithOnOffCommand()
{
    // Level from 0 to 255, where 255 = 100 %
    Level = byte.Parse(level),
    // Time for changing (smoothly overflow)
    TransitionTime = ushort.Parse(time)
};

await networkManager.Send(endpointAddress, command);

For a better overview just take a look at the official documents or our cluster definition file which is used for code generation. There will be all valid parameters, values, scales etc.