/// <summary> /// The Write Attributes Command /// /// The write attributes command is generated when a device wishes to change the /// values of one or more attributes located on another device. Each write attribute /// record shall contain the identifier and the actual value of the attribute to be /// written. /// /// @param records {@link List<WriteAttributeRecord>} Records /// @return the Task<CommandResult> command result Task /// </summary> public Task <CommandResult> WriteAttributesCommand(List <WriteAttributeRecord> records) { WriteAttributesCommand command = new WriteAttributesCommand(); // Set the fields command.Records = records; return(Send(command)); }
/// <summary> /// Write an attribute /// /// <param name="attribute">the attribute ID to write</param> /// <param name="dataType">the ZclDataType of the object</param> /// <param name="value">the value to set (as Object)</param> /// <returns>command Task CommandResult</returns> /// </summary> public Task <CommandResult> Write(ushort attribute, ZclDataType dataType, object value) { //logger.debug("{}: Writing cluster {}, attribute {}, value {}, as dataType {}", zigbeeEndpoint.getIeeeAddress(), // clusterId, attribute, value, dataType); WriteAttributesCommand command = new WriteAttributesCommand(); command.ClusterId = _clusterId; WriteAttributeRecord attributeIdentifier = new WriteAttributeRecord(); attributeIdentifier.AttributeIdentifier = attribute; attributeIdentifier.AttributeDataType = dataType; attributeIdentifier.AttributeValue = value; command.Records = new List <WriteAttributeRecord>(new[] { attributeIdentifier }); command.DestinationAddress = _zigbeeEndpoint.GetEndpointAddress(); return(Send(command)); }