---
name: "onDeviceStatusChange"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "onDeviceStatusChange - Register device status change event."
summary: "Register device status change event."
---

## onDeviceStatusChange

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

### Description

Subscribe to aggregated device status changes (online/sleep, etc.).

### Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `callback` | `(status: DeviceStatus) => void` | Yes | Callback for new status |

### Return Value

None


### Referenced Types

##### `interface` DeviceStatus

| Property | Type | Description |
| --- | --- | --- |
| `type` | `"offline" \| "online" \| "sleep"` | Overall status: online / offline / sleep |
| `connectEnable` | `boolean` | Whether users are allowed to initiate connections manually (e.g., BLE) |
| `onlineTypes` | `"local" \| "cloud" \| "ble" \| "localMatter" \| "unknown"[]` | Online channel list (bit semantics expanded into an array by the platform) |
| `sleepPeriod` | `Object` | Sleep window (sleep only) |
| `isWifiActive` | `boolean` | Whether the Wi‑Fi module is powered on and operating |
| `isWifiMatter` | `boolean` | Whether Matter over Wi‑Fi is supported |

##### `type` DeviceStatus.sleepPeriod

| Property | Type | Description |
| --- | --- | --- |
| `start` | `number` | Start |
| `end` | `number` | End |


### Examples

#### Example

```ts
import { onDeviceStatusChange } from '@ray-js/lock-sdk';
onDeviceStatusChange((status) => {
  console.log(status);
});
```
