Table of Contents | ||
---|---|---|
|
...
Return Type | Description |
---|---|
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 | ||
---|---|---|
| ||
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 Type | Description |
---|---|
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 | ||
---|---|---|
| ||
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 Type | Description |
---|---|
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 | ||
---|---|---|
| ||
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 Type | Description |
---|---|
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 | ||
---|---|---|
| ||
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 Type | Description |
---|---|
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 | ||
---|---|---|
| ||
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()); }); |
sendZclCommand(short commandId, byte[] payload, int clusterId, int manufacturerCode, boolean isServer, boolean isClusterSpecific, boolean responseRequired)
Usage
Sends a ZCL command (cluster specific, or general command) over the network to the specified cluster (server-side or client-side) and manufacturerCode.
...
Name | Type | Description |
---|---|---|
commandId | short | The ZCL command id. |
payload | byte[] | The payload in bytes. Each field in the payload is entered as LSB, so 2700 (decimal) would be 0x8C 0x0A. |
clusterId | int | The cluster to send the command to. |
manufacurerCode | int | The manufacturer code. 0 means "not manufacturing specific". |
isServer | boolean | Whether the cluster is a server cluster. |
isClusterSpecific | boolean | Whether the command is cluster specific (as opposed to a ZCL general command). |
responseRequired | boolean | Whether the system should wait for a response and relay it back. If a command does not have a response, this flag must be false, otherwise an error may be reported. |
Returns
Return Type | Description |
---|---|
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 | ||
---|---|---|
| ||
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()); }); |
...