Cloud Logic

Last Updated on : 2022-11-24 09:20:23download

To connect a device to the 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.

Terms

Term Description
PID The unique identifier of a product created on the Tuya IoT Development Platform, which is associated with the mobile app and cloud configuration.
DP The data model of a product, which denotes product functions.
Firmware key The identifier of the 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 IoT Development Platform.
Pairing The process where a device is added to a mobile app to interact with the Tuya IoT Development Platform through a gateway.

PID

The unique identifier of a product created on the Tuya IoT Development Platform. The 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.

Cloud Logic

DP

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.

    Cloud Logic

Firmware key

The identification information of firmware, which is generated after you Add Custom Firmware on the Tuya IoT Development 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.

Cloud Logic

Information of firmware key Description
Firmware identifier The written firmware name when you use the script to compile code.
The firmware type. It depends on the product type. Select Module Firmware if you use the NB-IoT protocol.
Chipset platform It is automatically generated based on your selected module.
Firmware version The firmware version is written when you use the script to compile code. This information is required when you upload firmware for production on the Tuya IoT Development Platform.

You must use the information of the firmware key specified on the Tuya IoT Development 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.

License

The license serves as the authentication information for device connection to the Tuya IoT Development Platform, which must be written to the chip in production.

In the pairing process, when a device attempts to connect to the cloud for registration, it sends the license to the cloud for authentication.

Tuya provides three options for license delivery based on flashing requirements.

Cloud Logic

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.

Pairing

The NB-IoT module supports pairing by QR code or device serial number.

For more information about device pairing, see Add device.