---
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

`(callback: Function)`

| 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" \| "yuChannel" \| "unknown"[]` | Online channel list (bit semantics expanded by the platform into an array) local LAN online cloud Cloud online ble Bluetooth online localMatter Matter LAN online yuChannel Cloud Bridge online unknown Unknown |
| `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 |
| `isActiveThread` | `boolean` | Whether the Thread channel is enabled |
| `isShareThread` | `boolean` | Whether it is a shared Thread device |

##### `type` DeviceStatus.sleepPeriod

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


### Examples

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