Skip to content

Get node and endpoint address

Markus edited this page Jul 10, 2019 · 1 revision

If you want to get a node in your network you have to use the ZigbeeNetworkManager class.

Here a demo to get node and it's endpoint address:

// Initialize COM Port
ZigBeeSerialPort zigbeePort = new ZigBeeSerialPort("COM4");

// Initialize dongle hardware e.g. CC2531
IZigBeeTransportTransmit dongle = new ZigBeeDongleTiCc2531(zigbeePort);

// Initialize NetworkManager
ZigBeeNetworkManager networkManager = new ZigBeeNetworkManager(dongle);

// Send OnCommand
await networkManager.Send(endpointAddress, new OnCommand());

// Get node by it's network address
// The network address can be stored in your database or another store
var node = networkManager.GetNode(4711);

// Create a endpoint address object
ZigBeeEndpointAddress endpointAddress = null;
// Get  default endpoint
var endpoint = node.Endpoints.Values.FirstOrDefault();

if (endpoint != null)
{
    // Get endpoint address
    endpointAddress = endpoint.GetEndpointAddress();
} 
else 
{
   throw new Exception("No Endpoint found!");
}

With the endpoint adress you can execute commands on a node

Clone this wiki locally