Last Updated on : 2024-11-20 08:51:35download
To connect a device to the Tuya Cloud and mobile apps, your development must follow a set of end-to-end principles. This topic describes these required principles and provides examples for better understanding.
The following core concepts guide you through the understanding of the principles.
Term | Description |
---|---|
Product ID (PID) | The unique identifier of a product created on the Tuya Developer Platform, which is associated with the mobile app and cloud configuration. |
Data point (DP) | The data model of a product, which denotes product functions. |
cJSON | The data communication between the device and the cloud is in cJSON format. |
Firmware key | The identifier of firmware associated with a PID. |
License | The license is also called production certificate, which serves as the authentication information for device connection to the Tuya Developer Platform. |
Pairing | The interaction process where you connect a device to a mobile app and the Tuya Developer Platform. |
OEM firmware | Different PIDs that belong to one product category can share the same OEM firmware. |
The unique identifier of a product created on the Tuya Developer Platform. The Tuya Cloud identifies products by PID and then sends data to a specified mobile app for display. The PID is the vital information of a product, which is typically written to the firmware code.
The data model of a product, which denotes product functions and serves for the communication between a device and the cloud. Tuya provides two types of product functions.
Standard Functions: The most common functions of a product category, which can be selected as needed.
Custom Functions: If the standard functions cannot address your needs, you can add and edit a custom function to implement a required function.
The data communication between the device and the cloud is in cJSON format.
The data transmitted between the device and the cloud are packaged in standard cJSON. When a device receives data from the cloud, it will parse the data in cJSON and then execute actions accordingly.
The identification information of firmware, which is generated after you Add Custom Firmware on the Tuya Developer Platform. The firmware key is associated with the PID and contains information including firmware identifier, firmware version, chipset platform, firmware type, update channel, and more.
Generally, you do not need to take care of the firmware key. But when multiple PIDs share the same firmware, you must specify the firmware key in your code and enable OEM settings.
Information of firmware key | Description |
---|---|
Firmware identifier | The written firmware name when you use the script to compile code. |
Firmware type | It depends on the product type. Select Module Firmware if you use the Wi-Fi protocol. |
Chipset platform | It is automatically generated based on your selected module. |
Firmware version | The written firmware version when you use the script to compile code. This information is required when you upload firmware for production on the Tuya Developer Platform. |
You must use the information of the firmware key specified on the Tuya Developer Platform for code compilation, including firmware identifier, firmware type, chipset platform, and firmware version. Otherwise, the flashing and authorization using Tuya’s host will fail.
The license serves as the authentication information for device connection to the Tuya Developer Platform, which must be written to the chip in production.
In the pairing process, when a device attempts to connect to the Tuya Developer Platform for registration through a Wi-Fi router, it sends the license to the cloud for authentication.
Tuya provides three options for license delivery based on flashing requirements. You can select an option on the Order Confirmation page.
License name | Description |
---|---|
Production certificate | Production certificate is the delivery mode for the combined firmware flashing and authorization solution. Tuya flashes the encrypted license to the chip using its proprietary host. The information of the firmware key will be verified to avoid writing any incorrect firmware information. This solution is recommended, but note that it supports Tuya standard chips only. |
Production Certificate - Authorization Only | Production certificate - authorization only is the delivery mode for the independent firmware flashing and authorization solution. Tuya flashes the encrypted license to the chip using its proprietary host. The information of the firmware key will not be verified. This solution applies to authorizing non-Tuya standard chips. |
License list | License list provides the plaintext of the license, which is not recommended. You must develop a host to flash the license to your chip. |
The pairing indicates a process where a device builds a connection to a mobile app and the cloud. The mobile app initiates a pairing request and sends the Wi-Fi router’s SSID and password to the device. When the device connects to the router, it will send the license to the cloud for authentication. A successful authentication means the communication between the device and the cloud is built.
Tuya provides a bunch of pairing modes, including manual pairing (such as Wi-Fi Easy Connect and Access Point), automatic pairing, pairing with QR code, and more. Note that the pairing mode must be consistent between the device and the mobile app so that the device can connect to the Tuya Developer Platform.
For more information about the code for device pairing, see the device pairing API description. Add devices provides instruction on pairing using mobile apps.
Generally, when a PID is written to firmware code, the compiled firmware only applies to this PID.
If several PIDs have identical functions, they can share the same firmware. Therefore, we can use the OEM logic without compilation per each PID.
For the OEM firmware, only the firmware key is written without PID. The compiled firmware can apply to different PIDs that belong to one product category.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback