Device SupportGroup Support
useActions()
Requires:
@ray-js/panel-sdk≥1.2.0
Description
Get the action method set for smart device capability points. Provides set, toggle, etc. based on the capability type. Commonly used with useProps: useProps reads state, useActions sends commands.
Parameters
None
Return Value
Type: Record<DpCode, DpActions>
Capability action collection keyed by capability code,
Each capability exposes different operations by type:
- All types: set(value) to send directly
- bool type: on() / off() / toggle() for quick switching
- value type: inc(step?) / dec(step?) to increment/decrement
Each capability exposes different operations by type:
- All types: set(value) to send directly
- bool type: on() / off() / toggle() for quick switching
- value type: inc(step?) / dec(step?) to increment/decrement
Referenced Types
interface
DpActions| Property | Type | Description |
|---|---|---|
| All types expose this method to send a DP point, but the value you pass depends on the DP type | ||
| Only bool and bitmap types have this method; enable the DP or set the specified bit | ||
| Only bool and bitmap types have this method; disable the DP or clear the specified bit | ||
| Available only for bool and bitmap types; toggle the datapoint or flip the specified bit | ||
| Available only for the value type; increment by the datapoint's step | ||
| Available only for value type; decrease by the current DP step (step) | ||
| Available only for enum type; switch to the previous enum value | ||
| Available only for enum type; switch to the next enum value | ||
| Available only for enum type; switch to a random enum value |
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
CustomRawDpMapCustom DP protocol converter for transforming between raw DP strings and structured objects.
Suitable for composite DPs of type raw/string (e.g., a light's colour_data "00ff003e8"),
splitting a single string into multiple semantic fields (e.g., { hue, saturation, value }).| Property | Type | Description |
|---|---|---|
| Parse the raw DP string reported by the device into a structured object | ||
| Serialize the structured object into a DP string to be sent to the device |
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.