Updated on 2023-02-16 GMT+08:00

Device Reporting a Message

Function

If a device cannot report data in the format defined in the product model, the device can use this API to report custom data to the platform, which then forwards the reported message to an application or other Huawei Cloud services for storage and processing.

For differences between message reporting and property reporting, see Message Communications Overview.

It is not suitable to report data in JSON format for devices with low configuration and limited resources or with limits on bandwidth usage. In this case, devices can transparently transmit the original binary data to the platform, but a codec is required to convert binary data to JSON format. For details about how to develop codecs, see Developing a Codec.

Topic

Upstream: $oc/devices/{device_id}/sys/messages/up

In addition to the preconfigured message reporting topic, devices can also use a topic not included in Topics. For example, /usr/xxx/data/up can be used.

Parameters

Parameter

Mandatory or Optional

Type

Description

object_device_id

Optional

String

Indicates the device to which the message is sent. If this parameter is not carried, the device specified in the topic is considered to be the intended device.

name

Optional

String

Indicates the message name.

id

Optional

String

Uniquely identifies a message.

content

Mandatory

Object

Indicates the message content.

IoTDA does not verify the format of the message reported by a device. The parameter description and example are for reference only. Devices can customize the data format as required.

Example

Topic: $oc/devices/{device_id}/sys/messages/up  
Data format:
{
    "object_device_id": "{object_device_id}",
    "name": "name",
    "id": "id",
    "content": {"hello":"123"}
}