Last Updated on : 2025-07-29 03:05:01download
This topic describes the specific functions of curtain switch templates and how to use these templates. For more information, see the GitHub repository.
Note: This project depends on
TYSdk.mobile.mobileInfo.appRnVersionv5.28 or later. If the earlier application version is used, go to Tuya Panel-RN to download the required version.
This curtain switch template project is built on React Native 0.59 and supports the following functions:
Note: This topic only describes the directories related to the scaffold. For more information about the general directory structure, see RN 0.59 TS Template.
├── 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.
│   ├── pages // 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 top bar. Rewrite the `renderScene` method to control routing jump.
│   ├── models // Includes the code of redux.
│   ├── res // Includes local resources, such as pictures and SVG paths.
│   ├── icons // Includes local resources, such as SVG paths.
│   └── utils // Includes common utility methods that are used on the panel.
| Parameter | Value | 
|---|---|
| id | 1 | 
| code | control | 
| type | enum | 
| mode | Send and report | 
| value | {“range”:[“open”,“stop”,“close”],“type”:“enum”} | 
| description | The DP is used to start, pause, or stop the motor. The enumeration value of this DP is not allowed to be modified, increased, or decreased. | 
| Parameter | Value | 
|---|---|
| id | 2 | 
| code | percent_control | 
| type | value | 
| mode | Send and report | 
| value | {“unit”:“%”,“min”:0,“max”:100,“scale”:0,“step”:1," type":“value”} | 
| description | The curtain motor can be used to monitor the current position of a curtain. For example, if the curtain is half opened with the opening percentage of 50%, you can use this DP to customize the position of the curtain. | 
| Parameter | Value | 
|---|---|
| id | 3 | 
| code | cur_calibration | 
| type | enum | 
| mode | Send and report | 
| value | {“range”:[“start”,“end”],“type”:“enum”} | 
| description | Send the DP value of start to start the calibration and the DP value of end to complete the calibration. | 
| Parameter | Value | 
|---|---|
| id | 8 | 
| code | control_back | 
| type | enum | 
| mode | Send and report | 
| value | {“range”:[“forward”,“back”],“type”:“enum”} | 
| Parameter | Value | 
|---|---|
| id | 14 | 
| code | light_mode | 
| type | enum | 
| mode | Send and report | 
| value | {“range”:[“relay”,“pos”,“none”],“type”:“enum”} | 
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback