Updated on 2024-12-02 GMT+08:00

Gateway Reporting Device Properties in Batches

Function

This API is used by a gateway to report property data of multiple child devices in batches to the platform. For details about the relationship between a gateway and its child devices, see Gateway and Child Devices.

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

A gateway can report the properties of a maximum of 100 child devices in each batch. If the number of child devices exceeds 100, you are advised to report their properties in different batches.

Topic

Upstream: $oc/devices/{device_id}/sys/gateway/sub_devices/properties/report

In the topic, device_id indicates the device ID of the gateway.

Parameters

Parameter

Mandatory/Optional

Type

Description

devices

Mandatory

List<DeviceService>

Explanation:

Device data, which is an array whose field name is devices. It is used to store the properties reported by different child devices.

DeviceService structure

Parameter

Mandatory/Optional

Type

Description

device_id

Mandatory

String

Explanation:

ID of the child device associated with the gateway, which is used to identify the properties reported by different child devices.

services

Mandatory

List<ServiceProperty>

Explanation:

List of device services.

ServiceProperty structure

Parameter

Mandatory/Optional

Type

Description

service_id

Mandatory

String

Explanation:

Service ID of the device, which is determined by the product model.

properties

Mandatory

Object

Explanation:

Property list of the device service. Multiple property parameters can be defined in the product model associated with the device. The property information is stored in the <property:value> format.

event_time

Optional

String

Explanation:

Indicates the UTC time when the device collects data. The value is in the format of yyyyMMdd'T'HHmmss'Z' or yyyy-MM-dd'T'HH:mm:ss.SSS'Z', for example, 20161219T114920Z or 2020-08-12T12:12:12.333Z.

If this parameter is not carried in the reported data or is in incorrect format, the time when the platform receives the data is used.

Example

Topic: $oc/devices/{device_id}/sys/gateway/sub_devices/properties/report
Data format:
{ 
    "devices":[ 
        { 
            "device_id":"bf40f0c4-4022-41c6-a201-c5133122054a", 
            "services":[ 
                { 
                    "service_id":"analog", 
                    "properties":{ 
                        "PhV_phsA":"1", 
                        "PhV_phsB":"2" 
                    }, 
                    "event_time":"20190606T121212Z" 
                }
            ] 
        }, 
        { 
            "device_id":"42aa08ea-84c1-4025-a7b2-c1f6efe547c2", 
            "services":[ 
                { 
                    "service_id":"analog", 
                    "properties":{ 
                        "PhV_phsA":"3", 
                        "PhV_phsB":"5" 
                    }, 
                    "event_time":"20190606T121212Z" 
                }, 
                { 
                    "service_id":"parameter", 
                    "properties":{ 
                        "Load":"6", 
                        "ImbA_strVal":"8" 
                    }, 
                    "event_time":"20190606T121212Z" 
                } 
            ] 
        } 
    ] 
}