getRoomList(params: Object)

Requires:
HomeKit≥3.1.0@ray-js/ray≥1.2.10
Platforms:
iOSAndroid
import { home } from '@ray-js/ray';

const { getRoomList } = home;

// Promise usage
try {
  const res = await getRoomList({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

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

Parameters

PropertyTypeRequiredDescriptionHomeKit Since
ownerIdnumberYesHome ID-
roomIdnumberYesRoom IDv3.7.10
devIdstringYesDevice IDv3.8.0
complete() => voidNoCompletion callback (executed on both success and failure)-
success(params: Object) => voidNoCallback on successful API call-
fail(params: Object) => voidNoFailure callback-
success callback parameters
PropertyTypeDescription
Room list
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

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

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