SmartDevicesManager.add(config: AddConfig)
Requires:
@ray-js/panel-sdk≥1.16.0
Description
Add a single device instance and complete initialization. If init() has not been called, it will auto-init first for backward compatibility. Typically used to dynamically add one associated device; throws an error if the deviceId already exists.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| Yes | Device config |
Return Value
Type: Promise<SmartDeviceModel>
Initialized device instance
Referenced Types
type
InitDpStateInterceptortype
InitDevInfoInterceptortype
OnDpDataChangeInterceptortype
OnDeviceOnlineStatusUpdateInterceptortype
OnDeviceInfoUpdatedInterceptortype
OnNetworkStatusChangeInterceptortype
OnBluetoothAdapterStateChangeInterceptortype
InitDpStateInterceptorParams| Property | Type | Required | Description |
|---|---|---|---|
| Yes | Current device DP state | ||
| Yes | New device DP state | ||
action | "init" | "onDpDataChange" | "onDeviceInfoUpdated" | "dp-kit" | Yes | Interceptor action |
type
GetSmartDeviceModelDevInfo| Property | Type | Required | Description |
|---|---|---|---|
dpCodes | object | Yes | |
dps | object | Yes | |
idCodes | object | Yes | |
codeIds | object | Yes | |
schema | S | Yes |
type
SmartDeviceModelAbilityContainer type for SmartDeviceModel abilities, used only for generic constraints and internal composition.type
PublishDpsOptionsUnderlying option type of publishDps, reused by the SDK’s internal request chain.| Property | Type | Required | Description |
|---|---|---|---|
| No |
type
DpValueDatapoint value type, which can be boolean, number, or string.type
SendDpOptionDP send options. Can be used as the global default configuration for createDpKit, and can also be overridden in a single publishDps/action call.
The global `sendDpOption` suits product-level defaults;
options passed for a single send are suitable for temporarily overriding throttling, debouncing, protocol parsing, or optimistic update strategies.
Note: requires the dp-kit interceptor.| Property | Type | Required | Description | Since |
|---|---|---|---|---|
immediate | boolean | No | Whether to trigger a state update immediately; requires the dp-kit interceptor | - |
| No | Whether to ignore DP reports; default false | v1.11.0 | ||
| No | Whether to sync dpData with cloud device properties; default false | v1.11.0 | ||
ordered | boolean | No | Whether to send multiple DPs in the order of the object’s keys; requires the dp-kit interceptor; default false | - |
checkRepeat | boolean | No | Whether to check for duplicate values and skip sending; requires the dp-kit interceptor; default false Compared with the current `dpState`; duplicates are detected and not sent | - |
delay | number | No | Delayed send; requires the dp-kit interceptor; default 0, in ms | - |
throttle | number | No | Send throttling (conflicts with debounce); requires the dp-kit interceptor; default 0, in ms | - |
debounce | number | No | Send debounce (conflicts with throttle); requires the dp-kit interceptor; default 0, in ms | - |
| No | A per-call DP protocol converter; requires the dp-kit interceptor. The key is the dpCode and the value is a `{ parser, formatter }` object: - parser(dpValue: string) => any — parses the raw DP string into a structured object - formatter(parsedValue: any) => string — serializes the structured object into a DP string Affects only this invocation and does not override the global protocols configuration in createDpKit | - |
type
Capabilitytype
DevAttributeValid Values
DevInfo.schema.mode
| Value | Description | Since |
|---|---|---|
rw | - | - |
ro | - | - |
wr | - | - |
DevInfo.schema.property.type
| Value | Description | Since |
|---|---|---|
string | - | - |
bool | - | - |
value | - | - |
enum | - | - |
bitmap | - | - |
raw | - | - |
DevInfo.schema.type
| Value | Description | Since |
|---|---|---|
raw | - | - |
obj | - | - |
FunConfig.tyabirysr4_app
| Value | Description | Since |
|---|---|---|
follow | - | - |
--app-B1 | - | - |
FunConfig.tyabis5d9w_app
| Value | Description | Since |
|---|---|---|
follow | - | - |
--app-M1 | - | - |
LogConfig.level
| Value | Description | Since |
|---|---|---|
VERBOSE | - | - |
SUCCESS | - | - |
INFO | - | - |
WARN | - | - |
FATAL | - | - |