Updated on 2023-10-18 GMT+08:00

Command Delivery Overview

Introduction

A product model defines commands that can be delivered to the devices. Applications can call platform APIs to deliver commands to the devices to effectively manage these devices.

The IoT platform supports synchronous and asynchronous command delivery.

Table 1 Command delivery overview

Mechanism

Description

Application

Devices Using LwM2M over CoAP

Devices Using MQTT

Synchronous command delivery

An application calls the synchronous command delivery API to deliver a command to a specified device for device control. The platform sends the command to the device and returns the command execution result in an HTTP request to the application. If the device does not respond, the platform returns a timeout message to the application.

Applicable to commands that must be executed in real time, for example, turning on a street lamp or closing a gas meter switch. Applications should determine the appropriate time to deliver a command.

Not applicable

Applicable

Asynchronous command delivery

An application calls the asynchronous command delivery API to deliver a command to a specified device for device control. The platform sends the command to the device and asynchronously pushes the command execution result to the application.

Asynchronous command delivery is classified into immediate delivery and delayed delivery.

  • In immediate delivery, the platform delivers commands to a device regardless of whether the device is online. If the device is offline or the device does not receive the command, the delivery fails.
  • In delayed delivery, the platform caches a command and delivers it to a device when the device goes online or reports data. If a device has multiple pending commands, the platform delivers the commands in sequence.
  • Immediate delivery applies to scenarios with high real-time requirements.
  • Delayed delivery applies to commands that do not need to be executed immediately, for example, configuring water meter parameters.

Applicable

Not applicable

Scenarios

  • Synchronous delivery applies to scenarios that require real-time command delivery.
  • Data needs to be forwarded to other Huawei Cloud services for storage and processing based on data forwarding rules.

Constraints

  • Maximum size of a single message: 256 KB.
  • Product models are required.
  • Devices need to respond to the synchronous command within 20 seconds.
  • A maximum of 20 asynchronous commands can be cached at a time.
  • The cache duration is configurable and cannot exceed 48 hours.