IoT Platform provides virtual devices for application development and testing. You can use virtual devices for application debugging by reporting properties, reporting events, configuring properties, and calling services. Devices that use custom data formats can also be supported.

Background information

An IoT development life cycle: After you completed the device development, the device can connect to and report data to the cloud, and then you start to develop applications used on the cloud. This development process is lengthy and time-consuming. IoT Platform supports virtual devices. A virtual device simulates a connection between a physical device and IoT Platform to report properties and events. You can complete the development and debugging of applications based on the data of virtual devices.

Limits:

  • The minimum time interval for pushing consecutive messages is 1 second.
  • The maximum number of messages that can be consecutively pushed is 1,000.
  • The maximum number of times that you can use the Push button per day to push debugging information is 100.
  • If the data format of the device is custom, the Base64-encoded string of the binary data cannot exceed 4,096 characters.
  • Virtual devices cannot be started when physical devices are online or disabled. After a physical device goes online, the corresponding virtual device automatically goes offline.

Procedure

  1. Log on to the IoT Platform console.
  2. In the left-side navigation pane, choose Maintenance > Online Debug.
  3. On the Online Debug page, select a device that you want to debug.

    After you select a device, the debugging page is displayed.

  4. Choose Debug Virtual Device > Start Virtual Device.
  5. Push the data for debugging.
    Option Procedure
    Report properties
    1. Click Properties.
    2. In the text box that corresponds to the property, enter the property value.

      You can enter a value that meets the property data type and value range, or use the random() function to generate a random value.

    3. Push the data.

      You can select the push method:

      • Push: Immediately pushes the data.
      • Push Policy: Sets a push policy.
        • At Specific Time: pushes data only once at the specified time.
        • At Specific Interval: pushes data at a fixed interval over a specified period. The interval is measured in seconds.
    Report events
    1. Click Events.
    2. In the text box for the event, enter the event value.

      You can enter a value that meets the property data type and value range, or use the random() function to generate a random value.

    3. Push Policy: Sets a push policy.
      • At Specific Time: pushes data only once at the specified time.
      • At Specific Interval: pushes data at a fixed interval over a specified period. The interval is measured in seconds.
    Get properties Obtain the property values of the device.
    1. Click Property Debugging.
    2. From the Debug Feature list, select the property to debug and set the method to Get.
    3. Click Dispatch Command.
      Note When you try to obtain the property of the device, you do not need to enter data in the text box.

    After you dispatch the command, the text box automatically shows the latest data of the property. If the device does not have a value for the property, the data is empty.

    Call services
    1. Click Service Calls.
    2. From the Debug Feature list, select the service to debug.
    3. In the text box, enter the input parameters for the service, and click Dispatch Command.

      The input parameters must be in JSON format, for example, {"Switch":0}.

Result

After data is pushed, you can view operation logs in the Real-time Logs section.

After the data is pushed, you can go to the Device Details page. On the Status tab, you can view the reported properties. On the Events tab, you can view the reported events. On the Invoke Service tab, you can view the records of service calls.

Note If you have specified Push Policy, you can view the logs, properties, and events information after the data has been pushed.