---
name: "SmartDeviceModel.getDpState"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.0.0" }
---

## SmartDeviceModel.getDpState

> [VERSION] @ray-js/panel-sdk >= 1.0.0

### 描述

获取智能设备功能点状态

### 参数

无


### 返回值

类型: `DpState`

全量功能点状态对象，key 为功能点 code，value 为功能点值，可能是 boolean、number、string

**`type` DpState**

```typescript
export type DpState = Record<string, DpValue>;
```

### 引用对象

##### `type` DpState

功能点状态对象，key 为功能点 code，value 为功能点值

```typescript
export type DpState = Record<string, DpValue>;
```

##### `type` DpValue

功能点值类型，可能为 boolean、number、string

```typescript
export type DpValue = boolean | number | string;
```


### 示例代码

#### 示例

```typescript
const dpState = device.getDpState();
console.log(dpState.switch_led);  // true（boolean，对应 bool 类型 DP）
console.log(dpState.brightness);  // 500（number，对应 value 类型 DP）
console.log(dpState.work_mode);   // 'white'（string，对应 enum 类型 DP）
```
