---
name: "SmartGroupModel.onGroupDpDataChangeEvent"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.5.0" }
title: "onGroupDpDataChangeEvent"
---

## SmartGroupModel.onGroupDpDataChangeEvent

> [VERSION] @ray-js/panel-sdk >= 1.5.0

### Description

Listen for DP change events in group devices

### Parameters

`(listener: Function)`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `listener` | `(data: GroupDpsChanged) => number` | Yes | Event callback that receives parameters including groupId, dps (mapping of changed DP IDs to values), etc. |

### Return Value

None


### Referenced Types

##### `type` GroupDpsChanged

DP change event callback parameters (group device)

| Property | Type | Description |
| --- | --- | --- |
| `groupId` | `string` | Group ID |
| `dps` | `DpState` | Changed DP data, where the key is the DP ID and the value is the DP value |

##### `type` DpState

Datapoint status object, where the key is the datapoint code and the value is the datapoint value.

```typescript
export type DpState = Record<string, DpValue>;
```

##### `type` DpValue

Datapoint value type, which can be boolean, number, or string.

```typescript
export type DpValue = boolean | number | string;
```


### Examples

#### Example

```typescript
const id = group.onGroupDpDataChangeEvent((data) => {
  console.log('Group DP changed:', data.dps);
});
// Unregister when needed
group.offGroupDpDataChangeEvent(id);
```
