use of com.zsmartsystems.zigbee.zcl.field.WriteAttributeRecord in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclCluster method write.
/**
* Write an attribute
*
* @param attribute the attribute ID to write
* @param dataType the {@link ZclDataType} of the object
* @param value the value to set (as {@link Object})
* @return command future {@link CommandResult}
*/
public Future<CommandResult> write(final int attribute, final ZclDataType dataType, final Object value) {
logger.debug("{}: Writing cluster {}, attribute {}, value {}, as dataType {}", clusterId, attribute, value, dataType);
final WriteAttributesCommand command = new WriteAttributesCommand();
command.setClusterId(clusterId);
final WriteAttributeRecord attributeIdentifier = new WriteAttributeRecord();
attributeIdentifier.setAttributeIdentifier(attribute);
attributeIdentifier.setAttributeDataType(dataType);
attributeIdentifier.setAttributeValue(value);
command.setRecords(Collections.singletonList(attributeIdentifier));
command.setDestinationAddress(zigbeeEndpoint.getEndpointAddress());
return send(command);
}
Aggregations