SmartLampAdvancedAbility.convertDp(dpCode: "color_temp_control" | "temp_value" | "bright_value", dpValue: number)
Requires:
≥1.15.0
Description
Convert a raw DP value to a display value with unit by DP; supports bright_value, temp_value, color_temp_control.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dpCode | "color_temp_control" | "temp_value" | "bright_value" | Yes | DP code |
dpValue | number | Yes | Raw DP value |
Return Value
Type: ConvertValue | null
On success, returns the display value and unit; returns { value, unit: '' } when the advanced capability is not enabled; may be null if the cloud has no valid translation. Network required.
Referenced Types
type
ConvertValue| Property | Type | Description |
|---|---|---|
value | number | Value |
unit | string | Unit |
Valid Values
dpCode
| Value | Description | Since |
|---|---|---|
color_temp_control | - | - |
temp_value | - | - |
bright_value | - | - |
Examples
Example
Notes
- This method detects whether advanced capability is enabled for the given DP code.
- If advanced capability is off, it returns the raw value and an empty unit.
- Conversion calls the cloud API
ty.device.dpTranslateAdvancedCapability; network is required. - On Matter devices, use
color_temp_controlfor color temperature. - On standard protocol devices, use
temp_valuefor color temperature. - Internally calls
getAdvanceHighEnabledfirst to check capability.