Versions Compared

Key

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

...

Return TypeDescription
DeviceType

A class

describing

containing a "type" field to describe the device at a logical level (i.e.

a

dimmable light

, thermostat, etc)

), as well as a "category" field to describe its group (i.e. lighting).

See the "Zigbee Device Descriptors" section in the Zigbee Specification References document for more details about what these identifiers would look like for zigbee devices.

Examples

Code Block
languagejava
GatewayClient gw = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"));
...
// use DeviceType to filter for all the lights on the network
Collection<Device> lights = gw.listDevices( d -> d.getDeviceType().getType().equals(LightDevice.DEVICE_TYPE"dimmable light") );
...


Properties API

getProperties()

...

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

...

final
Device device = gateway.getDevice(id);
final CompletableFuture<Collection<Property>> properties = device.getProperties();
            
// do some extra (asynchronous) handling on the properties, once they've been discovered.
properties.thenAccept( collection -> {
    // This code will be called from a thread managed by gateway api.
    // We should avoid blocking code in this section.
    for (Property p : collection) {
        System.out.println(p.toString());
    }
});

...

// one could also block on the CompletableFuture until it returns
Collection<Property> c = properties.get(30, TimeUnit.SECONDS); // wait (block) for up to 30 seconds to get the CollectCollection of Property objects back

getCachedProperties()

...