Step 3: Debug

更新时间:
复制 MD 格式

Before you publish a business service, you can use the device simulator to debug it.

Prerequisites

The business logic is configured, and the business service is deployed and running. For more information, see Step 2: Configure the air purification and alert service.

Background information

  • To debug a business service triggered by an HTTP API, click Debug. View the results in the log.

  • To debug a business service that uses a scheduled trigger, click Debug and enter a time. After the service runs, view the results in the log.

  • To debug a device-triggered business service, follow the procedure in this topic.

Procedure

  1. In the Business Logic Workbench, click the Debug icon and click Go to open the Device Simulator page of IoT Platform.

  2. Start the device simulator for both the trigger device and the actuator device.

  3. Use the virtual or physical air monitor to push simulated data.

    For more information about how to use the device simulator, see Device Simulator.

    This example uses two sets of simulated data:

    • PM2.5=10 and SO2=0.15: These values do not meet any of the conditions configured in the business service. As a result, the service sends a command to set the power switch property to false (Off) and sends an air quality report to the DingTalk group.

    • PM2.5=123 and SO2=0.20: These values meet one of the conditions configured in the business service. As a result, the service sends a command to set the power switch property to true (On) and sends an air quality report to the DingTalk group.

    The DingTalk group receives the following messages:

    • Air environment alert bot: Air quality is good!

    • Air environment alert bot: Air pollution detected. Remember to wear a mask when you go out!

  4. After pushing the data, go to the Device Details page of the air purifier. On the Status tab, view the corresponding property data.

  5. View the log.

    Return to the Business Logic Workbench. View the global and node logs for the service on the Global Logs and Node Logs tabs. If the service fails, the log displays the reason for the error. Use this information to fix the issue. The log shows execution details for each node in JSON format, including the node ID, node name, node type, and node input.

Next steps

Step 4: Publish