SmartDeviceModel.onDpDataChange
Requires:
@ray-js/panel-sdk≥1.0.0
Method signature
SmartDeviceModel.onDpDataChange(listener: )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 |
dps | Record<string, any> | Yes | Changed DP data, where the key is the DP ID and the value is the DP value |
dpsTime | Record<string, number> | No | Timestamp of the DP data change (may be empty) |