---
name: "getRoomList"
mode: "kit"
versionRequirements:
  - { name: "HomeKit", version: "3.1.0" }
  - { name: "@ray-js/ray", version: "1.2.10" }
platform:
  - "iOS"
  - "Android"
async: true
---

## getRoomList

> [VERSION] HomeKit >= 3.1.0 | @ray-js/ray >= 1.2.10

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Get the list of rooms under the current home from local cache, including the device ID list for each room

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `ownerId` | `number` | Yes | - | `3.1.0` | Home ID |
| `roomId` | `number` | Yes | - | `3.7.10` | Room ID |
| `devId` | `string` | Yes | - | `3.8.0` | Device ID |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `roomDatas` | `RoomData[]` | `3.1.0` | Room list |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Referenced Types

##### `interface` RoomData

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `roomId` | `number` | `3.1.0` | Room ID |
| `name` | `string` | `3.1.0` | Room name |
| `deviceIds` | `string[]` | `3.1.0` | Device IDs in the room |


### Examples

#### Demo

```tsx
import { home } from '@ray-js/ray'

home.getRoomList({
  ownerId: 8069808,
  roomId: 57426831,
  devId: "6c2a2eiadnrgt0wd",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
