Updated on 2022-02-24 GMT+08:00

Delivering Commands

Interface Function

This interface is used by the IoT platform to deliver commands to devices.

Parameters

Parameter

Mandatory or Optional

Type

Description

msgType

Mandatory

String

This parameter has a fixed value of cloudReq, which indicates that the IoT platform delivers a command.

serviceId

Mandatory

String

Service ID.

cmd

Mandatory

String

Command name. For details, see the profile file.

paras

Mandatory

ObjectNode

Command parameters. Detailed fields are defined in the profile file.

mid

Mandatory

Int

2-byte unsigned command ID. It is allocated by the IoT platform and ranges from 1 to 65535. This parameter must be returned when the device is required to send a command response to the IoT platform.

Example

MQTT 
A device can receive commands only after subscribing to the topic /huawei/v1/devices/{deviceId}/command/{codecMode}.
The following interface is used for northbound command delivery:
https://server:port/iocm/app/signaltrans/v1.1.0/devices/{deviceId}/services/{serviceId}/sendCommand?appId={appId} 
Payload received by the MQTT client:
{ 
"msgType": "{msgType}", 
"serviceId": "{serviceId}", 
"mid": 2016, 
"cmd": "{cmd}", 
"paras": { 
"value": 4 
} 
}