SmartDeviceModel.getDpSchema()

Requires:
@ray-js/panel-sdk≥1.0.0

Description

Get the smart device DP schema (function point) mapping

Parameters

None

Return Value

Type: Record<string, DpSchema>
DP model mapping object where the key is the DP code and the value includes attr, mode, property, type, etc.

Referenced Types

interfaceDpSchema
PropertyTypeDescription
attrnumberDP attribute flag bit, used to mark additional capabilities of the DP
canTriggerbooleanWhether it can be used as an automation trigger condition
codestringDP code, e.g., switch
defaultRecommendbooleanWhether it is the default recommended DP
editPermissionbooleanWhether it has edit permission
executablebooleanWhether it can be issued (sent downstream)
extContentstringDP extension content, typically a JSON string
iconnamestringDP icon name
idstring | numberDP ID
mode"rw" | "ro" | "wr"DP mode type
rw: writable and reportable (read/write)
ro: report-only (read-only)
wr: write-only
namestringDP name, typically used in voice scenarios
DP attributes
type"raw" | "obj"DP data type categories: raw for raw byte stream, obj for structured object

Examples

Example

const dpSchema = device.getDpSchema();
console.log(dpSchema.switch_led.property.type); // 'bool'

// Return value example (key is DP code):
// {
//   power: {
//     code: 'power', id: 1, name: 'Switch', mode: 'rw', type: 'obj',
//     property: { type: 'bool' }
//   },
//   mode: {
//     code: 'mode', id: 3, name: 'Cleaning mode', mode: 'rw', type: 'obj',
//     property: { type: 'enum', range: ['standby', 'random', 'smart', 'wall_follow', ...] }
//   }
// }