---
name: "SmartLampAdvancedAbility.convertDp"
mode: "api"
versionRequirements:
  - { name: "", version: "1.15.0" }
title: "convertDp - 转换 DP 功能点值。根据指定的 DP 功能点代码，将原始值转换为带单位的显示值。支持转换的 DP 功能点包括："
summary: "根据指定的 DP 功能点代码将原始值转换为带单位的显示值，支持亮度和色温。"
---

## SmartLampAdvancedAbility.convertDp

> [VERSION] v1.15.0+

> 💡 单设备与群组均支持；内部先 getAdvanceHighEnabled，再调 ty.device.dpTranslateAdvancedCapability。

### 描述

按功能点将原始 DP 值转为带单位的显示值；支持 bright_value、temp_value、color_temp_control。

### 参数

`Params`

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `dpCode` | `"color_temp_control" \| "temp_value" \| "bright_value"` | 是 | 功能点编码 |
| `dpValue` | `number` | 是 | 功能点原始数值 |

### 返回值

类型: `ConvertValue \| null`

成功为显示值与单位；未启用高级能力时返回 { value, unit: '' }；云端无有效翻译时可能为 null。需网络。

### 引用对象

##### `type` ConvertValue

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `value` | `number` | 数值 |
| `unit` | `string` | 单位 |


### 示例代码

#### 示例

```typescript
const b = await sdm.lampAdv.convertDp('bright_value', 100);
const t = await sdm.lampAdv.convertDp('temp_value', 2700);
const m = await sdm.lampAdv.convertDp('color_temp_control', 2700);
```


**注意事项**

1. 该方法会自动检测设备是否启用了对应 DP 功能点的高级能力
2. 如果未启用高级能力，会直接返回原始值和空单位
3. 转换过程会调用云端接口 `ty.device.dpTranslateAdvancedCapability`，需要网络连接
4. 对于 Matter 设备，色温功能点使用 `color_temp_control`
5. 对于标准协议设备，色温功能点使用 `temp_value`
6. 该方法内部会先调用 `getAdvanceHighEnabled` 检查能力是否启用
