...
You can update a Device Property as followsby providing the name and value.
For example, to update the "OnOff" property, you could do something like the following:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
final Device d = gw.getDevice(idStr); Property property = new Property(propertyId"OnOff, "", writeValue); d.updateProperty(property).getFuture().whenComplete( (result, throwable) -> { if (throwable != null) { System.out.println("error: " + throwable.getMessage()); } else if (result != null) { System.out.println("result: " + result.getValue()); } }); |
Conclusion
...
boolean", "true");
gw.getDevice(id).updateProperty(property); |
Conclusion
This programming guide has shown how to initialize a GatewayClient, join devices, get their properties, and interact with them in a simple way.
To explore further, please see theĀ API documentation.