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

Topic Definition

Subscription Message Topic (for Directly Connected Devices in One-Device-One-Secret Mode)

To obtain messages and data delivered by the IoT platform, a device must send an MQTT message to subscribe to a specified topic after successful login.

The format of the topic for a SUBSCRIBE message is /huawei/v1/devices/{deviceId}/command/{codecMode}.

  • codecMode: indicates the encoding and decoding mode of the SUBSCRIBE messages. If a user-defined codec is used, the value of codecMode is binary. Otherwise, the value is json.
  • deviceId: For one-device-one-secret devices, the value of this parameter is deviceId returned after the device is successfully registered when the device uses deviceId to access the IoT platform. The value can also be nodeId entered during device registration with the IoT platform when the device uses nodeId to access the IoT platform.

Data Reporting Message Topic (for Directly Connected Devices in One-Device-One-Secret Mode)

To report data through an MQTT channel, a device must send data to a specified topic.

The format of the topic for a PUBLISH message is /huawei/v1/devices/{deviceId}/data/{codecMode}.

  • codecMode: indicates the encoding and decoding mode of the PUBLISH messages. If a user-defined codec is used, the value of codecMode is binary. Otherwise, the value is json.
  • deviceId: For one-device-one-secret devices, the value of this parameter is deviceId returned after the device is successfully registered when the device uses deviceId to access the IoT platform. The value can also be nodeId entered during device registration with the IoT platform when the device uses nodeId to access the IoT platform.