Step 3: Debug and deploy

Updated at:
Copy as MD

This topic describes how to use the device simulator to debug the smart air conditioner service.

Prerequisites

You have configured the business logic. For more information, see Step 2: Create a business service to control the air conditioner.

Procedure

  1. On the business service editing page, click the Deploy & Debug button 部署 in the upper-right corner to deploy and start the service.

  2. After the service is deployed, click the Deploy & Debug button 部署 again in the upper-right corner to debug the service.

    1. In the dialog box that appears, click Go to to open the device simulator page for the product.

    2. Click Start Simulator.

    3. Select Uplink Command Debugging > Report Property.

    4. In the default module, send a debug command.

      In this example, the current temperature is set to 10. Because this value is less than 15, the business logic sends a command to the smart air conditioner.

      The device logs return code:200, message:success, indicating that the property reporting was successful.

  3. On the Device Simulator page for the smart air conditioner, you can view the received command in the Device Logs section. This confirms that the device simulator received and executed the parameter adjustments from the business logic orchestration.

    received topic=/sys/a1*******/Airconditioner/thing/service/property/set, payload={"method":"thing.service.property.set","id":"10*********","params":{"Switch":1,"WindSpeed":4,"temperature_setting":26,"WorkMode":2},"version":"1.0.0"}  
    • Switch (air conditioner switch): 1 (true)

    • WindSpeed (wind speed): 4 (high)

    • temperature_setting (temperature setting): 26 (°C)

    • WorkMode (work mode): 2 (heating)

    Return to the business logic editing page to view the logs.

    After you return to the business logic editing page, green check marks appear on the Device Trigger, Condition, and Path Selection nodes on the visual orchestration canvas, indicating successful execution. Below the canvas, the Global Logs panel displays the run logs for all nodes in a JSON tree. The input for the Device Trigger node (type input) includes fields such as deviceContext (containing productKey, deviceName, and gmtCreate) and props (containing CurrentTemperature).

  4. On the business service editing page, click the Deploy button 发布 in the upper-right corner to deploy the service.

    You must deploy a business service to the cloud before you can call it.