Device SupportGroup Support
useStructuredActions()
Requires:
@ray-js/panel-sdk≥1.10.0
Additional notesRead the full notes
Implemented based on the sdm instance and the dp-kit interceptor. Must be used inside SdmProvider.
Before using, ensure the project has mounted SdmProvider; see Smart Device Model - Usage. New projects can start from the public-sdm example.
Ensure the dp-kit interceptor has been configured; see Interceptors - Usage.
Only send methods for DPs with protocol rules are returned; basic-type DPs are excluded (use useActions for basic types).
Supports both single devices (SmartDeviceModel) and groups (SmartGroupModel). Symmetric with useStructuredProps: useStructuredProps reads structured data via Transformer.parser(), while useStructuredActions formats structured data into DP commands via Transformer.formatter().
Before using, ensure the project has mounted SdmProvider; see Smart Device Model - Usage. New projects can start from the public-sdm example.
Ensure the dp-kit interceptor has been configured; see Interceptors - Usage.
Only send methods for DPs with protocol rules are returned; basic-type DPs are excluded (use useActions for basic types).
Supports both single devices (SmartDeviceModel) and groups (SmartGroupModel). Symmetric with useStructuredProps: useStructuredProps reads structured data via Transformer.parser(), while useStructuredActions formats structured data into DP commands via Transformer.formatter().
Description
Get the collection of structured DP send methods after dp-kit protocol transformation
Parameters
None
Return Value
Type: Record<DpCode, { set: (value: object, options?: SendDpOption) => Promise<boolean> }>
A collection of structured DP send methods. The key is a DP code configured with protocols; each key provides a set(structuredValue) method. The input type of set is determined by the parameter type of the corresponding Transformer.formatter(); internally it calls formatter to convert structured data to a DP string before sending to the device
Referenced Types
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 | Description | Since |
|---|---|---|---|
immediate | boolean | Whether to trigger a state update immediately; requires the dp-kit interceptor | - |
| Whether to ignore DP reports; default false | v1.11.0 | ||
| Whether to sync dpData with cloud device properties; default false | v1.11.0 | ||
ordered | boolean | Whether to send multiple DPs in the order of the object’s keys; requires the dp-kit interceptor; default false | - |
checkRepeat | boolean | 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 | Delayed send; requires the dp-kit interceptor; default 0, in ms | - |
throttle | number | Send throttling (conflicts with debounce); requires the dp-kit interceptor; default 0, in ms | - |
debounce | number | Send debounce (conflicts with throttle); requires the dp-kit interceptor; default 0, in ms | - |
| 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
IgnoreDpChangeInterceptorOptionsConfiguration option to ignore the DP data change interceptor
Used to configure the debounce mechanism for DP reporting events on the device panel, preventing immediate responses after panel operations from affecting user experience or business logic| Property | Type | Description |
|---|---|---|
whiteDpCodes | string[] | DP whitelist; reports will not be ignored |
timeout | number | Debounce timeout check, in milliseconds, default 5000 - The maximum time between sending a DP from the panel and receiving the DP reply; dpDataChange is triggered only if this is exceeded. - Used to debounce DP reporting events |
| Custom ignore rules > Highest priority; when configured, whiteDpCodes and timeout become ineffective |
type
DevPropInterceptorOptions| Property | Type | Description |
|---|---|---|
blackDpCodes | string[] | DP blacklist; will not be synchronized to the cloud |
| Default device state on first entry; supports async initialization | ||
throttle | number | Send throttling, in milliseconds, defaults to 0 If set to 0, throttling is disabled. |
type
DpStateDatapoint status object, where the key is the datapoint code and the value is the datapoint value.type
DpValueDatapoint value type, which can be boolean, number, or string.