After you configure a physical device in IoT Platform console, you can debug features of the device by pushing commands to the device from the IoT Platform console. This topic describes the online debugging procedure.

Prerequisites

The device is created in the IoT Platform console and connected to IoT Platform. For more information about how to configure and connect devices to IoT Platform, see What is Link SDK?.
Note You can also use the device simulator or MQTT.fx to simulate a device and connect the simulated device to IoT platform, and then debug the device online. For more information, see Device simulation or Connect a device to IoT Platform by using MQTT.fx.

After the simulated device is connected, device topics are generated. For more information about how to subscribe to topics and use topics, see Generate topics.

Limits

You can debug only devices that are connected over MQTT.

Debug features

  1. Log on to the IoT Platform console.
  2. On the Overview page, find the instance and click the instance name to go to the Instance Details page.
    Notice Enterprise Edition instances are available only in the China (shanghai) and Japan (Tokyo) region. If your IoT Platform is not activated in the China (shanghai) or Japan (Tokyo) region, skip this step.
    Overview
  3. In the left-side navigation pane, choose Maintenance > Online Debug.
  4. On the Online Debug page, select the device that you want to debug.
  5. Click the Property Debugging or Service Calls tab. On the tab, select a Thing Specification Language (TSL) model from the Module drop-down list.
    在线调试
    Type Procedure
    Property Debugging
    Notice You must have the read and write permissions on the property that you want to manage. The available operations include Set and Set expectations.
    • Get: obtains the latest value of a specified property from the device. If no value has been set for the property, no value is displayed in the field.

      On the right side of a property field, click Debugging. Then, click Get.

    • Set: sends a command from IoT Platform to the device to set a property value. After the device receives the command, the device sets the property value in the TSL model based on the command, and submits the latest property value to IoT Platform.

      Enter a value in a property field and click Debugging. Then, click Set.

    • Set expectations: sends a command from IoT Platform to the device to set a desired property value.

      Enter a value in the property field and click Debugging. Then, click Set expectations.

      When the command is sent:

      • If the device is online, the device receives the command, updates the property value, and then submits the new property value to IoT Platform.
      • If the device is offline, the device obtains the desired property value after it goes online, updates the property value, and then submits the new property value to IoT Platform.

    You can also click Get, Set, or Set expectations below all property fields to debug multiple properties.

    Service Calls
    1. Select the service that you want to debug from the Debug Feature drop-down list.
    2. In the field, enter the input parameters of the service. Then, click Send Command.

      The input parameters must be in the JSON format. Example: {"Switch":0}.

View debugging logs

After you push the command, you can view the operation logs in the Real-time Logs section on the right side of the page. You can also view the debugging results on the TSL Data tab of the Device Details page.

Notice During online debugging, IoT Platform uses the Revert-Remote Procedure Call (RRPC) synchronous communication mechanism to send commands to devices. This allows online simulated devices to receive debugging logs when the devices are not subscribed to topics. You can simulate devices by using tools such as MQTT.fx. You can choose Maintenance > Device Log to view detailed logs.

The following figures show how to view the debugging logs.

  • Debug properties: Enter a property value, click Debugging on the right, and then click Set. The debugging logs are displayed in the Real-time Logs section on the right. 属性设置
  • Debug service calls: Select a service, enter the input parameters of the service, and then click Send Command. The debugging logs are displayed in the Real-time Logs section on the right. 服务调用