...
Code Block | ||
---|---|---|
| ||
GatewayClient gw = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0")); ... // turn a light device on final Device d = gw.getDevice(id); Property property = new Property("OnOff, "boolean", "{\"value\":true}"); // value is a JSON string with the new value of the property d.updateProperty(property).getFuture().whenComplete( (result, throwable) -> { if (throwable != null) { System.out.println("error: " + throwable.getMessage()); System.out.println("suggestion: ensure you are forming the correct JSON request, with property key:value pairs"); } else if (result != null) { System.out.println("result: " + result.getValue()); } }); |
...
Note that if the Properties of a Device haven't yet been discovered, the bind will fail. It is assumed that the properties of a Device have been discovered (using a call like getProperties for example) before being able to bind to a specific Property.
Parameters
...