Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel2

...

Return TypeDescription
CompletableFuture<Property>

Contains a CompletableFuture<Property> of the zigbee attribute being read.

Will return exceptionally on any and all errors; the exception will contain an errorCode and description.

Examples

Code Block
languagejava
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"));
...
Device device = gateway.getDevice(id);

// blocking
Property property = ((ZigbeeDevice)device).readAttribute(0x0000, 0x0001).get();
System.out.println(property.toString());

...

// async
((ZigbeeDevice)device).readAttribute(0x0000, 0x0001).thenAccept( property -> {
    System.out.println(property.toString());
});

...

Return TypeDescription
CompletableFuture<Property>

Contains a CompletableFuture<Property> of the zigbee attribute being read.

Will return exceptionally on any and all errors; the exception will contain an errorCode and description.

Examples

Code Block
languagejava
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"));
...
Device device = gateway.getDevice(id);

// blocking
Property property = ((ZigbeeDevice)device).readAttribute(0x0000, 0x0001, 0xFC01, true).get();
System.out.println(property.toString());

...

// async
((ZigbeeDevice)device).readAttribute(0x0000, 0x0001, 0xFC01, true).thenAccept( property -> {
    System.out.println(property.toString());
});

...

Return TypeDescription
CompletableFuture<Property>

Contains a CompletableFuture<Property> of the zigbee attribute being written.

Will return exceptionally on any and all errors; the exception will contain an errorCode and description.

Examples

Code Block
languagejava
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"));
...
Device d = gateway.getDevice(id);

// blocking
Property p = ((ZigbeeDevice)d).writeAttribute(0x0201, 0x0012, 0x29, new byte[] {(byte)0x8C, (byte)0x0A}).get();
System.out.println(p.toString());

...

// async
((ZigbeeDevice)d).writeAttribute(0x0201, 0x0012, 0x29, new byte[] {(byte)0x8C, (byte)0x0A}).thenAccept( property -> {
    System.out.println(p.toString());
});

...

Return TypeDescription
CompletableFuture<Property>

Contains a CompletableFuture<Property> of the zigbee attribute being written.

Will return exceptionally on any and all errors; the exception will contain an errorCode and description.

Examples

Code Block
languagejava
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"));
...
Device d = gateway.getDevice(id);

// blocking
Property p = ((ZigbeeDevice)d).writeAttribute(0xF001, 0x0001, 0x29, new byte[] {(byte)0x8C, (byte)0x0A}, 0xFC01, true).get();
System.out.println(p.toString());

...

// async
((ZigbeeDevice)d).writeAttribute(0xF001, 0x0001, 0x29, new byte[] {(byte)0x8C, (byte)0x0A}, 0xFC01, true).thenAccept( property -> {
    System.out.println(p.toString());
});

...

Return TypeDescription
CompletableFuture<Property>

Contains a CompletableFuture<Property> with a JSON string of the ZCL Command Response.

Will return exceptionally on any and all errors; the exception will contain an errorCode and description.

Examples

Code Block
languagejava
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"));
...
Device d = gateway.getDevice(id);

// blocking command to discover commands that the OnOff cluster can receive
Property p = ((ZigbeeDevice)d).sendZclCommand(0x11, new byte[] {(byte)0x00, (byte)0xFF}, 0x0006).get();
System.out.println(p.toString());

...

// async command to discover the commands that the OnOff cluster can receive
((ZigbeeDevice)d).sendZclCommand(0x11, new byte[] {(byte)0x00, (byte)0xFF}, 0x0006).thenAccept( property -> {
    System.out.println(p.toString());
});

...

Return TypeDescription
CompletableFuture<Property>

Contains a CompletableFuture<Property> with a JSON string of the ZCL Command Response.

Will return exceptionally on any and all errors; the exception will contain an errorCode and description.

Examples

Code Block
languagejava
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"));
...
Device d = gateway.getDevice(id);

// blocking command to discover commands that the OnOff cluster can receive
Property p = ((ZigbeeDevice)d).sendZclCommand(0x11, new byte[] {(byte)0x00, (byte)0xFF}, 0xFC01, 0xFCC0, true, true, true).get();
System.out.println(p.toString());

...

// async command to discover the commands that the OnOff cluster can receive
((ZigbeeDevice)d).sendZclCommand(0x11, new byte[] {(byte)0x00, (byte)0xFF}, 0xFC01, 0xFCC0, true, true, true).thenAccept( property -> {
    System.out.println(p.toString());
});

...

Sends a ZCL command (cluster specific, or general command) to the specified groupId, cluster (server-side or client-side) and manufacturerCode.

A Returns a CompletableFuture of a Collection of Property objects, where each Property contains a JSON string with a ZCL command response. The CompletableFuture completes exceptionally on any errors.

...

Returns

Return TypeDescription
CompletableFuture<Property>CompletableFuture<Collection<Property>>

Contains a CompletableFuture<Collection<Property>>. Each Property is a JSON string of a single received ZCL Command Response.

Will return exceptionally on any and all errors; the exception will contain an errorCode and description.

Examples

Code Block
languagejava
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"));
...
ZigbeeDevice zd = (ZigbeeDevice)gateway.getDevice(id);

// multicast the "on" command to the "OnOff" cluster to group id 3
zd.sendZclMulticastCommand(0x0003, 0x01, null, 0x0006, 0x0000, true, true, false);

...

Sends a ZCL command (cluster specific, or general command) to the specified broadcast address, cluster (server-side or client-side) and manufacturerCode.

A Returns a CompletableFuture of a Collection of Property objects, where each Property contains a JSON string with a ZCL command response. The CompletableFuture completes exceptionally on any errors.

...

Returns

Return TypeDescription
CompletableFuture<Property>CompletableFuture<Collection<Property>>

Contains a CompletableFuture<Collection<Property>>. Each Property is a JSON string of a single received ZCL Command Response.

Will return exceptionally on any and all errors; the exception will contain an errorCode and description.

Examples

Code Block
languagejava
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"));
...
ZigbeeDevice zd = (ZigbeeDevice)gateway.getDevice(id);

// broadcast the "off" command to the "OnOff" cluster, to all devices
zd.sendZclBroadcastCommand(0xFF, 0x00, null, 0x0006, 0x0000, true, true, false);

...