Simple Cloud-Connected Switch
Wire up a TuyaOpen switch you can control from the app, with secure cloud authentication.
Project Overview
Build a minimal cloud-connected switch on TuyaOpen โ flash the switch_demo, fill in your PID, UUID, and AuthKey in tuya_config.h, and control the switch from the Tuya app. The demo runs across Tuya T5/T2/T1, ESP32, and Linux SoCs, and shows the core DP (Data Point) control loop you extend to build out custom devices.

Features
- Simple Tuya cloud-connected switch device
- App-based remote control
- Minimal and easy-to-understand codebase
- Secure device authentication (PID, UUID, Auth Key)
- Supports multiple hardware platforms
Supported Hardware
- Hardware platforms/chip models: Tuya T5, Tuya T2, Tuya T1, ESP32, Linux SoCs, and more
Quick Start
- Clone the TuyaOpen repository or download the source code.
- Set up your development environment following the Quick Start Guide.
- Obtain your Device (UUID/Auth Key) Key Pair from the Tuya Developer Platform.
- Update the credential information in the
tuya_config.hheader file. - Compile and flash the firmware to your device.
- Run and debug your IoT Switch.
Need Custom Features?
The PID (Product ID) is a unique string used to identify and associate your product definition in the cloud. If you want to implement control for multiple sensors or multiple switches, you can create your own custom device ("product") on the Tuya Developer Platform here and define your own control DPs (Data Points). This allows you to achieve more complex and diverse device functions through the cloud. Finally, on the device, update the PID of your defined product in the tuya_config.h header file and develop support for the new DP points as needed.