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

## SmartGroupModel.onDeviceInfoUpdated

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

> 💡 在群组设备环境中，原生 @ray-js/ray 的 onDeviceInfoUpdated 实际上不会触发。
> 为了同时自动适配单设备和群组设备环境，这里会在底层 onGroupInfoChange 触发时同步执行该回调。

### 描述

监听智能群组设备信息变更事件

### 参数

`(listener: Function)`

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `listener` | `(data: DeviceInfoChanged) => number` | 是 | 事件回调，接收包含设备信息变更等数据的参数 |

### 返回值

无


### 引用对象

##### `type` DeviceInfoChanged

设备信息变更事件回调参数

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `deviceId` | `string` | 设备 id |
| `dps` | `DpState` | 变化的功能点数据（可能为空） |

##### `type` DpState

功能点状态对象，key 为功能点 code，value 为功能点值

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

##### `type` DpValue

功能点值类型，可能为 boolean、number、string

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


### 示例代码

#### 示例

```typescript
const id = group.onDeviceInfoUpdated((data) => {
  console.log('群组信息变更:', data);
});
// 需要时取消监听
group.offDeviceInfoUpdated(id);
```
