Report Device Events (Non-Passthrough)¶
A device can publish a message to this topic to report the newly added event to the cloud.
If the non-passthrough mode is used, the device data sent to the cloud will be in JSON format.
Upstream
Request TOPIC:
/sys/{productKey}/{deviceKey}/thing/event/{tsl.event.identifier}/post
Reply TOPIC:
/sys/{productKey}/{deviceKey}/thing/event/{tsl.event.identifier}/post_reply
Note
tsl.service.identifier is the identifier of the event that has been defined in the model.
Sample Request Format¶
{
"id": "123",
"version": "1.0",
"params": {
"events": {
"Power": {
"value": 1.0,
"quality": 9
},
"temp": 1.02,
"branchCurr": [
"1.02", "2.02", "7.93"
]
},
"time": 123456
},
"method": "thing.event.{tsl.event.identifier}.post"
}
Sample Response Format¶
{
"id": "123",
"code": 200,
"data": {}
}
Request Parameter Description¶
Parameter |
Type |
Mandatory/Optional |
Description |
---|---|---|---|
id |
String |
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 |
Object |
Mandatory |
The parameters used for reporting the device events. |
events |
Object |
Mandatory |
The list of the device’s events. |
Power |
Struct |
Optional |
The identifier of the measurement point that you want to report. In this example, the measurement point has the identifier Power. The value you set for the point must match the data type defined for this parameter. In this case, the data type for Power is struct, defined with 2 paramters value and quality. |
value |
Integer |
Optional |
The parameter name of the struct data type of the measurement point Power. 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. |
quality |
Integer |
Optional |
The parameter name of the struct data type of the measurement point Power. In this example, the quality parameter indicates the data quality. Similar to the above, the value you set must match the data type defined for this parameter. |
temp |
Integer |
Optional |
The identifier of the measurement point that you want to report. In this example, the measurement point has the identifier temp. Similar to the above, the value you set must match the data type defined for this parameter. |
branchCurr |
Array |
Optional |
The identifier of the measurement point that you want to report. In this example, the measurement point has the identifier branchCurr. Similar to the above, the value you set must match the data type defined for this parameter. |
time |
String |
Optional |
The timestamp of the event. When not specified, the value is the server time. |
method |
String |
Optional |
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. |
data |
JSON |
Optional |
The detailed returned information in JSON format. |
Return Code¶
Return Code |
Error Message |
Explanation |
---|---|---|
1204 |
Model validate failed |
|