...
Code Block |
---|
language | java |
---|
title | Getting the Properties of the Remote DeviceDiscovering Properties |
---|
linenumbers | true |
---|
|
if (event.getStatus() == DeviceEventStatus.ADD) {
final Collection<Property> properties = event.getDevice().getProperties();
for (Property p : properties) {
System.out.println("name: " + p.getName() + ", value: " + p.getValue() + ", type: " + p.getType());
}
} |
Updating Properties
You can update a Device Property as follows
Code Block |
---|
language | java |
---|
title | Updating a Property |
---|
linenumbers | true |
---|
|
final Device d = gw.getDevice(idStr);
Property property = new Property(propertyId, "", 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
...