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());
});


readAttribute(int clusterId, int attributeId, int manufacturerCode, boolean isServer)

...

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());
});


writeAttribute(int clusterId, int attributeId, short dataType, byte[] value)

...

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).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).thenAccept( property -> {
    System.out.println(p.toString());
});

...