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

## SmartDeviceModel.onDeviceInfoUpdated

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

### Description

Listen for smart device info change events (including changes to device name, DP names, etc.)

### Parameters

`(listener: Function)`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `listener` | `(data: DeviceInfoChanged) => number` | Yes | Event callback that receives parameters containing deviceId, changed data, etc. |

### Return Value

None


### Referenced Types

##### `type` DeviceInfoChanged

Device info change event callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `deviceId` | `string` | Device ID |
| `dps` | `DpState` | Changed DP data (may be empty) |

##### `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 = device.onDeviceInfoUpdated((data) => {
  console.log('Device info changed:', data.deviceId);
});
// Unsubscribe
device.offDeviceInfoUpdated(id);
```
