Create Products

Last Updated on : 2023-01-29 07:31:53download

There are three approaches to developing a product by using Tuya’s Wi-Fi module or Wi-Fi and Bluetooth Low Energy (LE) combo module.

  • No-code development: A straightforward graphic interface lets you develop fully functional firmware for your smart products without writing a line of code.
  • MCU SDK development: Implement features on the MCU and use the MCU SDK to enable serial communication between the MCU and Tuya’s network module. The MCU SDK provides function implementation for a suite of features including two-way communication, OTA updates, and data parsing. You can port the SDK to your MCU for interface adaptation and call interfaces to achieve the required functionality.
  • TuyaOS-based SDK development: Perform custom development on top of the TuyaOS-based SDKs. The SDK encapsulates interface functions that are implemented in the hardware abstraction layer (HAL), system layer, network layer, and OTA updates. You can directly call these interfaces to write application code without taking care of the logic behind it.

This topic describes the operations on the Tuya IoT Development Platform when you develop with the TuyaOS-based SDK and introduces six data types and three data transfer types used for defining DPs.

Product creation

To develop with the TuyaOS-based SDK, you need to create a product on the Tuya IoT Development Platform and select the function, panel, and module to get the data point (DP) ID and product ID (PID). Log in to the Tuya IoT Development Platform. If you do not have an account, you need to register first.

The example in this topic uses the CBU module to show you how to create a cool white light product on the platform.

Select product category

  1. On the homepage of the platform, Click Create.

    Create Products
  2. Under the Standard Category tab, choose Lighting > Light Source.

    Create Products

Select development solution

  1. Choose TuyaOS > Custom Solution.

    The no-code development allows you to generate the firmware by configuring it in a graphical interface without coding. For more information, see No-Code Development. To perform custom development on top of the SDK, choose Custom Solution.

    Create Products
  2. Complete the required information and select a protocol. Click Create.

    The example uses the CBU Wi-Fi and Bluetooth LE combo module, so Wi-Fi - Bluetooth is chosen as the protocol.

    If you are not clear about what protocol your module uses, check out the datasheet.

    Create Products

Define product functions

  1. Select the standard functions as needed and click OK.

    If the standard functions cannot meet your needs, you can create custom functions. Note that the standard functions can be displayed and operated properly on the app panel but this might not work for the custom functions.

    To ensure the stable operation of your product, we recommend the total number of standard functions and custom functions be limited to 40. Otherwise, make sure to test the stability of your product.

    Create Products

Select app panel

Select an app panel you prefer. The app panel is used to interact with your product.

Create Products

Set hardware parameters

  1. Click the Hardware Development tab. Choose TuyaOS and then the module for use. We choose CBU Wi-Fi & Bluetooth Module.

    Create Products
  2. After you build the firmware, you can click Add Custom Firmware to upload it.

  3. You can download the SDK from the Download Documents section. In this example, the SDK is ty_iot_wf_bt_sdk_rtos_BK7231N.

    Create Products

DP overview

Data point (DP): An abstract representation of a feature you want to apply to a physical device, which can be defined by various data types.

  • DP ID: The ID of a DP. The two-way communication between the device and the cloud is based on the DP ID. The first 100 DP IDs are reserved for Tuya use. The custom DP ID starts with 101.

  • DP data type: The platform supports six data types, including Boolean, value, enum, fault, string, and raw.

    • Boolean, value, and enum: basic data types, applying to most features.
    • Fault: used to define errors.
    • String and raw: used to define complex features. You can try these two types if the other types cannot meet your needs.

Boolean

Apply to a binary variable that is either true or false. For example, define the on and off state for a switch.

Create Products

Value

Apply to a variable that can be linearly adjusted. For example, temperature ranges from 20°C to 40°C.

Create Products
  • Value range: specifies the valid values that are between the maximum and minimum values.
  • Pitch: specifies the difference between adjacent values. Assume that a variable ranges from 0 to 100:
    • When the pitch is 1, the valid values are 0, 1, 2, 3 …
    • When the pitch is 2, the valid values are 0, 2, 4, 6 …
    • When the pitch is 3, the valid values are 0, 3, 6, 9 …
  • Scale: specifies the maximum number of digits after the decimal point in a number. Assume that a device reports 9999 to the app:
    • When the scale is 0, 9999 is displayed on the app panel.
    • When the scale is 1, 999.9 is displayed on the app panel.
    • When the scale is 2, 99.99 is displayed on the app panel.
    • When the scale is 3, 9.999 is displayed on the app panel.

Enum

Apply to a finite collection of custom values. For example, operation modes can be low, medium, and high.

An enum value can only contain letters, numbers, and underscores. After entering a value, press the ENTER button to confirm. The code of enum value starts from 0. An enum value is transmitted by its code. An enum value must not exceed 15 characters. Up to 10 enum values can be created.

Create Products

Fault

Apply to fault reporting. Multiple faults can be reported in one event. For example, temperature sensor faults, motor faults, and high temperature problems.

Create Products

String

Apply to DP data transmitted in string format. The length of a string must not exceed 255 bytes.

Create Products

Raw

Apply to DP data transmitted in binary format. The length of raw data must not exceed 255 bytes.

Create Products

Data transfer type

The data transfer type of fault data is fixed to report only (read-only). For the other five data types, the data transfer type can be set as needed.

Data transfer type Description
Send and report (read-write) Two-way data transmission between the device and the cloud.
Report only (read-only) One-way data transmission. Data can only be reported from the device.
Send only (write-only) One-way data transmission. Data can only be sent from the cloud.

Device panel

You can choose an all-in-one panel or use the SDK to develop a custom panel. The panels for some products support drag-and-drop configuration.

For more information, see Panel Development.

Develop hardware

Select the development method and module. Download the SDK and upload the custom firmware.

For more information, see Manage Custom Firmware.

Product configuration

Configure product-specific features including firmware update, multilingual support, push notification, pairing guides, quick toggle, smart scenes, and more.

For more information, see Product Configuration.