Last Updated on : 2024-06-05 03:14:30download
This topic describes the specific functions of classic light bulb templates and how to use these templates. For more information, see the GitHub repository.
Note: This project depends on
TYSdk.mobile.mobileInfo.appRnVersion
v5.28 or later. If the earlier application version is used, go to Tuya Panel-RN to download the required version.
The template project is a JavaScript basic template based on React Native 0.59 and can be used to create one to five-way light bulbs with a few simple steps. The template project supports the following functions:
The template project supports the following protocols:
Note: This topic only describes the directories related to the scaffold. For more information about the general directory structure, see RN 0.59 TS.
├── src │ ├── api // Includes multiple types of cloud API operations that are used to run the project. │ ├── components // Includes reusable functional components that are used to run the project. │ ├── composeLayout.tsx // Encapsulates `device events` and `device information` that are required on the panel. │ ├── config // Includes common configuration files that are used on the panel. │ ├── containers // Includes page-level components of the project. │ ├── i18n // Includes configuration files to support multiple languages. │ ├── main.tsx // The project entry files that are inherited from `NavigatorLayout`. Rewrite the `hookRoute` method to define necessary configurations, such as the background and topbar. Rewrite the `renderScene` method to control routing jump. │ ├── redux // Includes the code of redux. │ ├── res // Includes local resources, such as pictures and SVG path. │ └── utils // Includes common tools and methods that are used on the panel.
Parameter | Value |
---|---|
id | 20 |
code | switch_led |
type | bool |
mode | Can be reported and sent. |
value | {“type”:“bool”} |
description | Turns on and off the light bulb. |
Parameter | Value |
---|---|
id | 21 |
code | work_mode |
type | enum |
mode | Can be reported and sent. |
value | {“range”:[“white”,“colour”,“scene”,“music”],“type”:“enum”} |
description | Controls the White, Color, and Scene modes of the light bulb. The enumeration value of the DP cannot be modified. The Music function is not available on the panel. |
Parameter | Value |
---|---|
id | 22 |
code | bright_value |
type | value |
mode | Can be reported and sent. |
value | {“min”:10,“max”:1000,“scale”:0,“step”:1," type":“value”} |
description | Controls the brightness value of the light bulb. The value of the DP cannot be modified, increased, or decreased. |
Parameter | Value |
---|---|
id | 23 |
code | temp_value |
type | value |
mode | Can be reported and sent. |
value | {“min”:0,“max”:1000,“scale”:0,“step”:1," type":“value”} |
description | Controls the temperature value of the light bulb. The value of the DP cannot be modified, increased, or decreased. |
Parameter | Value |
---|---|
id | 24 |
code | colour_data |
type | string |
mode | Can be reported and sent. |
value | {“type”:“string”,“maxlen”:255} |
description | Controls the colored light of the light bulb. The length of the value is set to 12 bits. The HSV model is supported. Example: {“24”:“000011112222”}
|
Parameter | Value |
---|---|
id | 25 |
code | scene_data |
type | string |
mode | Can be reported and sent. |
value | {“type”:“string”,“maxlen”:255} |
description | The scene DP. All scene parameters are included. Example: {“25”:“0011223344445555666677778888”}
Note: Each digit that ranges from 1 to 8 in the preceding example specifies a unit and a group. |
Parameter | Value |
---|---|
id | 28 |
code | control_data |
type | string |
mode | Can only be sent. |
value | {“type”:“string”,“maxlen”:255} |
description | Controls the stepless dimming of white light and colored light of the light bulb. Example: {“28”:“011112222333344445555”}
|
Parameter | Value |
---|---|
id | 28 |
code | control_data |
type | string |
mode | Can only be sent. |
value | {“type”:“string”,“maxlen”:255} |
description | Controls the stepless dimming of white light and colored light of the light bulb. Example: {“28”:“011112222333344445555”}
|
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback