SmartDeviceModel.onDpDataChange(listener: Function)
Requires:
@ray-js/panel-sdk≥1.0.0
Description
Listen for smart device DP change events
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
listener | (data: DpsChanged) => number | Yes | Event callback that receives parameters containing deviceId, dps (changed DP ID→value mapping), etc. |
Return Value
Type: number
Listener ID used to unsubscribe via offDpDataChange
Referenced Types
type
DpsChangedDP change event callback parameters (single device)| Property | Type | Required | Description |
|---|---|---|---|
deviceId | string | Yes | Device ID |
gwId | string | No | Gateway device ID for a sub-device; absent for non-sub-devices |
| Yes | Changed DP data, where the key is the DP ID and the value is the DP value | ||
| No | Timestamp of the DP data change (may be empty) |