Device network status
Wi-Fi-connected devices can report their network status and error data to the cloud over a specific topic. This topic describes the reporting topic, data format, and network error codes.
Device-initiated network status reports
Data is sent from the device to the cloud (uplink communication).
Request topic: /sys/${productKey}/${deviceName}/_thing/diag/post
Response topic: /sys/${productKey}/${deviceName}/_thing/diag/post_reply
The Alink request data format:
- Current data: Data reported immediately after collection.
A device reports network status data immediately in these cases:
- A network error occurs. The device collects the relevant metrics and reports the data immediately.
- Scheduled collection is configured. The device collects and reports data at the specified time.
For example, if a device detects a network problem at 2019-08-22 08:10:29, it reports the data immediately. The data format for a network error:
{ "id": "123", "version": "1.0", "params": { "p": { "wifi": { "rssi": 75, "snr": 20, "per": 10, "err_stats":"10,02,01;10,05,01" }, "_time": 1566432629000 }, "model": "quantity=single|format=simple|time=now" } }Note For scheduled reports of normal network data, the err_stats parameter is empty. - Historical data: Data that is not reported immediately. During routine diagnostics, a device can delay reporting normal network metrics and report historical data in batches.
Data format:
{ "id": "123", "version": "1.0", "params": { "p": [ { "wifi": { "rssi": 75, "snr": 20, "per": 10, "err_stats":"10,02,01;10,05,01" }, "_time": 1566432629000 } ], "model": "format=simple|quantity=batch|time=history" } }Note If there are no network errors, the err_stats parameter is empty.
| Parameter | Type | Description |
| id | String | The message ID. A string-type number. The value must be unique for the device and range from 0 to 4294967295. |
| version | String | The protocol version number. The only valid value is 1.0. |
| params | Object | The request parameters. |
| wifi | Object | The Wi-Fi network status parameters. This parameter contains four network status metrics. |
| rssi | integer | The received signal strength. |
| snr | integer | The signal-to-noise ratio. |
| per | integer | The packet loss rate. |
| err_stats | String | The error data. Included only when the device detects a network error. Format: Parameter descriptions:
For details about the errors, see Table err_stats. |
| _time | Long | The timestamp. Note The timestamp can be empty. If it is empty, the collection time is not displayed on the Device Network Status page in the console. |
| model | String | The message body pattern. Contains the following fields:
|
| Error type | Meaning | Cause |
| 0x00 | Wireless environment parameters. |
|
| 0x10 | The device failed to establish a connection with the cloud. |
|
| 0x20 | Network error between the device and the cloud. |
|
| 0x30 | Device runtime error. |
|
| 0x40 | Dynamic monitoring of device memory. |
|
| 0x50 | BLE error. | BLE error |
The Alink response data format:
{
"id": "123",
"version": "1.0",
"code": 200,
"data": {}
}
| Parameter | Type | Description |
| id | String | The message ID. A string-type number. The value must be unique for the device and range from 0 to 4294967295. |
| code | Integer | The result code. A value of 200 indicates success. |
| version | String | The protocol version number. The only valid value is 1.0. |
| data | Object | The value is empty. |