5.1.7.3.15 ZCL_WriteAttributeValue Function

Syntax

ZCL_Status_t ZCL_WriteAttributeValue(Endpoint_t endpointId, ClusterId_t clusterId,uint8_t clusterSide,  ZCL_AttributeId_t attrId, uint8_t attrType, uint8_t *attrValue);

Description

This function finds an attribute in ZCL and rewrites its value by the new one.

The function sets or rewrites only local attributes and impacts attribute reporting when changes occur. To set a new value to an attribute on a remote device, send a write attributes general cluster command via the ZCL_AttributeReq() function.

Input Parameters
Parameter NameDescription
endpointIdEndpoint where the cluster is registered
clusterIdCluster unique identifier
clusterSideDetects the cluster’s side (client or server)
attrIdAttribute unique identifier
attrTypeType of the attribute to be set
attrValuePointer to attribute value to be set

Return Type and Values

  • The status of the operation:
    • ZCL_SUCCESS_STATUS (0x00) – New value is written successfully
    • ZCL_UNSUPPORTED_ATTRIBUTE_STATUS (0x86) – Does not support the specified attribute is not supported
    • ZCL_INVALID_PARAMETER_STATUS (0xFF) – NULL is provided as the attribute’s value
    • ZCL_INVALID_DATA_TYPE_STATUS (0x8D) – The attribute’s type is not the same as specified in the argument
    • ZCL_READ_ONLY_STATUS (0x88) – Cannot change the value of the attribute because the attribute is read-only