Common Parameters

Last Updated on : 2022-09-05 07:28:29download

This topic describes the parameters that are frequently used in the development of cloud projects and how to get these parameters.

Cloud project parameters

After the project is created, you will find a project ID and authorization key (Access ID and Access Secret) on the project details page.

Common Parameters

No. Parameter Description How to get
1 projectId The ID of a specified project. See Query project information.
2 Access ID/Client ID The Access ID/Client ID in a cloud application key pair. After a cloud application is created in the cloud development section of Tuya IoT Platform, accessId is generated by default for authorization and interface authentication. See Query project information.
3 Access Secret/Client Secret The Access Secret/Client Secret in a cloud application key pair. After a cloud application is created in the cloud development section of Tuya IoT Platform, accessKey is generated by default for authorization authentication and interface authentication. See Query project information.

Product parameters

After you select or create a product category, and then configure the product solution, a unique product ID (PID) is generated. For example, under the standard category Lighting, select the standard category Light Source (Category ID is dj), and select the protocol and function attributes. A product will be created with a unique PID such as rvmopq1ckfta****.

No. Parameter Description How to get
1 category_id The ID of a specified product category. You can view the standard categories currently supported by cloud development through Standard Instruction Set. For example, the category ID of the light source is dj. See View basic information.
2 product_id Each product created on the Tuya IoT Platform has a unique product ID (PID). See Get the device information and Get device details.

Common Parameters

Device parameters

You can produce several devices for each product category, and each device will be identified by a device ID or a universally unique identifier (UUID).

No. Parameter Description How to get
1 device_id The device ID, the device identifier generated by the cloud. The device ID varies depending on real devices. The device ID might be changed to deal with the impact of malicious attacks on normal use. The device ID does not change when the device is running properly, and might change after re-activation. See View Devices.
2 uuid A UUID is a unique number generated by various algorithms to identify hardware or software. A UUID is 20 bits long. The UUID will not change during the whole process from production to destruction, similar to the inherent attributes of devices such as MAC or IMEI. See Get the device information and Get device details.
3 UID The unique user ID under an app. See Link Tuya app account.

Common Parameters

Common Parameters

Parameters of instruction set and status set

Hardware manufacturers implement hardware features based on the product data points. Tuya provides a set of standard instruction sets and status sets to shield the product differences, simplify the method of device control, and help you quickly implement device control. In the API, code identifies a unique standard instruction or status, and value is the value of a specified feature.

No. Parameter Description How to get
1 code The unique device identifier.
  • Instruction set: A set of instructions provided by Tuya to simplify the device control. It is distinguished by product category. The instruction set under different PIDs in the category is a subset of the category instruction set.
  • Status set: A set used to describe the functional status of a device. It is distinguished by product category. The status set under different PIDs in the category is a subset of the category status set.
    Note: You can use the instruction set and status set according to the actual data sending and reporting scenarios. Tuya has created certain easy-to-use standard instruction sets for you. For more information, see Standard Instruction Set.
See Get the device information and Get device details.
2 value The value of the feature status. See Standard Instruction Set.

Common Parameters

FAQs

Q: What is the relationship between device category ID, PID, device ID, and UUID?
A: Their relationship can be explained with the production scenarios of mobile phones that we are more familiar with. Assuming that under the mobile phone product category, you need to produce three products XPhone10, XPhone11, and XPhone12, the relationship is similar to the figure below.

Common Parameters

Corresponding to the products on the Tuya IoT Platform, taking the power strip (category ID of pc) as an example, the relationship of the parameters is shown in the figure below.

Common Parameters

  • category: product category ID. One product category can contain multiple products. For example, the category ID of the power strip is pc.
  • product_id: product ID. The power strip category can be divided into different products according to the number of sockets or the protocol. In this example, according to the number of sockets, the power strips are divided into two-outlet power strips, three-outlet power strips, and four-outlet power strips. They have different product IDs.
  • device_id: device ID. Each product can contain multiple devices. The value of device_id for a device can be changed through cloud operations.
  • uuid: the universally unique identifier of a device, which is similar to the device ID. However, the value of uuid cannot be changed.