English
English
简体中文
Contact Us
Register
Log In

Change Control Instruction Mode

Last Updated on : 2023-05-09 10:30:55download

This topic describes how to change the control instruction mode of a device on the Tuya IoT Development Platform.

Control modes

You can choose from the following two control instruction modes during cloud development.

Mode
Description Scenario
Standard instruction set A standard instruction set is a set of control function instructions that can be sent to devices. It provides a suite of standard descriptions of device functions. After you send standard instructions in JSON format, Tuya converts them into device data points (DPs) in the cloud for the purpose of device control. During cloud development, devices are controlled in standard instruction mode by default. However, the standard instruction set cannot cover all the functions of devices in Tuya’s ecosystem. For more information about product categories that can be controlled with standard instruction sets, see the Standard Instruction Set documents.
DP instruction Control devices with original DP instructions. You can access the original DP information of your products. This mode is suitable for some products that contain non-standard instruction sets. When you cannot control a smart product through the standard instruction set, you can change to the DP instruction mode and control the product using originally defined DPs. Some non-standard DPs are protocols customized by manufacturers. After DP transmission, Tuya only transmits data without parsing. In this case, you can consult the manufacturers for data parsing.

If you modify the functional DP of a product, configurations of the DP instruction mode will be automatically updated in about four hours.

Prerequisites

  • You have linked a device with the cloud project. For more information, see Link Devices.
  • You operate under the main IoT account, rather than the authorized account.

Step 1: View products of a project

  1. Log in to the Tuya IoT Development Platform.

  2. Visit My Cloud Projects.

  3. Click the target project.

  4. In the top navigation bar, choose Devices > All Devices.

  5. In the section of View Devices by Product, click the ellipsis button to view a list of products.

    Change Control Instruction Mode

    The PIDs in the product list represent the products of all devices bound with the app or app account in the linked cloud project.

Step 2: Change control instruction mode

  1. Hover over the target product, and click the view button to view instruction details. Alternatively, you can click the edit button to Configure Control Instruction Mode.

    Change Control Instruction Mode

  2. On the page of the control instruction mode, you can:

    1. Query the details of standard instruction sets of the specified product. Also, you can click Change Instruction Mode at the bottom to configure the mode.

      Change Control Instruction Mode

    2. On the page of Configure Control Instruction Mode, you can change the control instruction mode to DP Instruction.

      Change Control Instruction Mode

    3. Click Save Configuration.

    4. On the page of View Details, click Refresh Configuration to refresh and view the details.

      Changes to the control instruction mode will take effect immediately in the China data center. If your product is deployed in a data center other than China Data Center, click the Refresh Configuration button on the corresponding data center page to manually refresh the details .

During subsequent cloud development, you need to use the instruction mode you set to control the devices.

Step 3: Adjust the mode of sending instructions

Take the lighting color colour_data DP of smart lights as an example.

  • Standard instruction mode: Send instructions in JSON format.

    {
        "code": "colour_data",
        "value":
        {
            "h": 37,
            "s": 255,
            "v": 188
        }
    }
    
  • DP instruction mode: Send instructions based on the DP protocol of the specified product category. After transparent transmission, the value parameter in the standard instruction mode shall be sent in String format. You need to concatenate the parameters yourself.

    Data type Value range Instruction example
    String 000011112222, among which:
    • 0000: the hue. Valid values: 0 to 360, corresponding to 0X0000 to 0X0168.
    • 1111: the saturation. Valid values: 0 to 1000, corresponding to 0X0000 to 0X03E8.
    • 2222: the value. Valid values: 0 to 1000, corresponding to 0X0000 to 0X03E8.
    {"code": "colour_data", "value": "00DC004B004E"}

    HSV value is 00DC 004B 004E in hexadecimal format. After converting them to the decimal format, you will get 220°, 75%, 78%.