SmartGroupModel.onDeviceInfoUpdated(listener: Function)

Requires:
@ray-js/panel-sdk≥1.5.0

Description

Listen for smart group device info change events

Parameters

ParameterTypeRequiredDescription
listener(data: DeviceInfoChanged) => numberYesEvent callback that receives parameters containing device info changes and related data

Return Value

Type: number
Listener ID, used to cancel via offDeviceInfoUpdated

Referenced Types

typeDeviceInfoChangedDevice info change event callback parameters
PropertyTypeRequiredDescription
deviceIdstringYesDevice ID
NoChanged DP data (may be empty)
typeDpStateDatapoint status object, where the key is the datapoint code and the value is the datapoint value.
export type DpState = Record<string, DpValue>;
typeDpValueDatapoint value type, which can be boolean, number, or string.
export type DpValue = boolean | number | string;

Examples

Example

const id = group.onDeviceInfoUpdated((data) => {
  console.log('Group info changed:', data);
});
// Unregister when needed
group.offDeviceInfoUpdated(id);