Report Attributes¶
A device can publish a message to this topic to report the newly added attributes to the cloud.
Upstream
Request TOPIC:
/sys/{productKey}/{deviceKey}/thing/attribute/update
Reply TOPIC:
/sys/{productKey}/{deviceKey}/thing/attribute/update_reply
Sample Request Format¶
{
"id": "123",
"version": "1.0",
"params": {
"attributes": {
"attr1": {
"value": 1.0,
"value2": 9
},
"attr2": 1.02,
"attr3": [1.02, 2.02, 7.93]
}
},
"method": "thing.attribute.update"
}
Sample Response Format¶
{
"id": "123",
"code": 200,
"data": {}
}
Request Parameter Description¶
Parameter |
Type |
Mandatory/Optional |
Description |
---|---|---|---|
id |
Long |
Optional |
The message ID. It is a reserved parameter that is reserved for future use. |
version |
String |
Mandatory |
The version of the protocol. The current version is 1.0. |
params |
List |
Mandatory |
The parameters used for reporting the attributes. |
attributes |
Object |
Mandatory |
The list of the device’s attributes. A request can carry a maximum of 200 attributes. When not specified, no attribute will be reported. |
attr1 |
Struct |
Mandatory |
The identifier of the attribute that you want to report. In this example, the attribute has the identifier attr1. The format here must match the data type defined for this parameter. In this case, the data type for attr1 is struct, defined with 2 parameters value and value2. |
value |
Integer |
Mandatory |
The parameter name of the struct data type of the attribute attr1. The value you set must match the data type defined for this parameter. For example, when the data type of this parameter is set to integer in the model, the value here must be an integer. |
method |
String |
Mandatory |
The request method. |
Response Parameter Description¶
Parameter |
Type |
Mandatory/Optional |
Description |
---|---|---|---|
code |
Integer |
Mandatory |
The return code. “200” indicates that the requested operation is executed successfully. |
Return Code¶
Return Code |
Error Message |
Explanation |
---|---|---|
1204 |
Model validate failed |
|
1207 |
Attribute update data format error |
Invalid request format. |