---
title: "SDM Smart Device Model Overview - OOP-based standard panel development paradigm and DP reporting/command sending"
summary: "SDM (Smart Device Model) is an OOP-based Panel MiniApp development library provided by @ray-js/panel-sdk. It encapsulates device data management, device control, status monitoring, and difference smoothing. Quick start: create a project in Tuya MiniApp IDE with the SDM general template, use useProps to get DP values (raw values when protocols are not configured), useStructuredProps to get structured values (protocols required), use useActions to send DP commands (without protocols), and useStructuredActions to send structured DP commands (protocols required). Ray/React projects are supported."
questions:
  - "What is the SDM Smart Device Model, and how does it encapsulate device data management, control, and status monitoring with OOP?"
  - "How do I select the SDM general template in Tuya MiniApp IDE to create a new project?"
  - "What is the difference between return values from useProps when protocols are configured or not configured?"
  - "When sending DP commands, when should useActions and useStructuredActions be used respectively (raw values vs. structured values)?"
  - "What steps are included in the SDM standard development paradigm (project creation, page creation, DP reporting and command sending)?"
  - "How does the SDM model smooth differences across devices with different protocols such as Wi-Fi, Bluetooth, and Zigbee?"
  - "How do I install @ray-js/panel-sdk with yarn add and start using SDM?"
  - "What are the advantages of SDM compared with directly using MiniApp APIs to develop panels?"
  - "Does SDM support both Ray framework and React projects?"
  - "What problems do SDM submodules such as Hooks, interceptors, and state management solve?"
---

# 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).

<Image src='/images/panel/sdm-intro.png' style={{ width: '375px' }}/>

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

1. Create a project in [Tuya MiniApp IDE](/en/miniapp/devtools/tools) (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.
2. Run the project and create a new page under `pages`.
3. Listen for DP reporting and send DP commands.

- Get the latest DP value when the DP is not configured with [protocols](/en/miniapp/solution-panel/ability/common/sdm/interceptors/dpkit/usage) => `const power = useProps((props) => props.power);`
- Get the latest DP value when the DP is configured with [protocols](/en/miniapp/solution-panel/ability/common/sdm/interceptors/dpkit/usage) => `const power = useProps((props) => props.power);`
- Modify the DP value when the DP is not configured with [protocols](/en/miniapp/solution-panel/ability/common/sdm/interceptors/dpkit/usage) => `const actions = useActions();`
- Modify the DP value when the DP is configured with [protocols](/en/miniapp/solution-panel/ability/common/sdm/interceptors/dpkit/usage) => `const actions = useStructuredActions();`

```shell
$ yarn add @ray-js/panel-sdk

# or

$ npm install @ray-js/panel-sdk
```

<Image src='/images/panel/sdm.gif'/>

> Ray/React project

<Image src='/images/panel/sdm-react.gif'/>
