Smart Device Model
The Panel MiniApp provide a wealth of rich and flexible APIs, and it is challenging for beginners to figure out how to call and combine them. We also provide an Intelligent Device Model (SDM).
Simply put, it is an OOP based Panel MiniApp development library that encapsulates device data management, device control, status monitoring, and difference smoothing, allowing you to reduce excessive attention to details during the panel development process and use a standard development paradigm for efficient development.
How to get started
- Create a project in Tuya MiniApp IDE (if you have not used it before, open the link to learn how to use it), and select the SDM General Template when choosing a template.
- Run the project and create a new page under
pages. - Listen for DP reporting and send DP commands.
- Get the latest DP value when the DP is not configured with protocols =>
const power = useProps((props) => props.power); - Get the latest DP value when the DP is configured with protocols =>
const power = useProps((props) => props.power); - Modify the DP value when the DP is not configured with protocols =>
const actions = useActions(); - Modify the DP value when the DP is configured with protocols =>
const actions = useStructuredActions();
Ray/React project