Skip to content

Room Information

Feature Description

This section introduces how to manage rooms in a home, including creating a room, editing a room name, deleting a room, moving a device to a room, setting room orders, and querying device lists in a room.

Room Management

Create Room

API

Create a room in a home.

kotlin
fun addFamilyRoom(fid: String, roomName: String, callback: QuecCallback<Unit>)

Parameter

ParameterRequiredDescription
fidYHome ID.
roomNameYRoom name.
callbackYCallback function of the request.

Example

kotlin
QuecSmartHomeService.addFamilyRoom("fid", "roomName") {
    if (it.isSuccess) {
        //Create a room in a home successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Edit Room Name

API

Edit a room name.

kotlin
fun setFamilyRoom(frid: String, roomName: String, callback: QuecCallback<Unit>)

Parameter

ParameterRequiredDescription
fridYRoom ID.
roomNameYRoom name.
callbackYCallback function of the request.

Example

kotlin
QuecSmartHomeService.setFamilyRoom("fid", "newRoomName") {
    if (it.isSuccess) {
        //Edit a room name successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Delete Room

API

Delete a room or multiple rooms in batches.

kotlin
fun deleteFamilyRooms(fridList: List<String>, callback: QuecCallback<Unit>)

Parameter

ParameterRequiredDescription
fridListYRoom ID list.
callbackYCallback function of the request.

Example

kotlin
QuecSmartHomeService.deleteFamilyRooms(listOf("fid")) {
    if (it.isSuccess) {
        //Delete rooms successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Move Device to Room

API

Move a device or multiple devices in batches to a room.

kotlin
fun addDeviceInFamilyRoom(
    deviceList: List<QuecAddDeviceEnterModel>, callback: QuecCallback<QuecFamilyAddDeviceModel>
)

Parameter

ParameterRequiredDescription
deviceListYDevice list.
callbackYCallback function of the request.

QuecAddDeviceEnterModel Definition

FieldTypeDescription
pkStringProductKey.
dkStringDeviceKey.
oldFridStringOriginal room ID.
nFridStringNew room ID.

QuecFamilyAddDeviceModel Definition

FieldTypeDescription
successListList<QuecFamilyAddDeviceListModel>List of successful executions.
failureListList<QuecFamilyAddDeviceListModel>List of failed executions.

QuecFamilyAddDeviceListModel Definition

FieldTypeDescription
oldFridStringOriginal room ID.
nFridStringNew room ID.
pkStringProductKey.
dkStringDeviceKey.
codeIntError code (Only valid for failureList).
StringStringError message (Only valid for failureList).

Example

kotlin
QuecSmartHomeService.addDeviceInFamilyRoom(
    listOf(
        QuecAddDeviceEnterModel(
            "pk",
            "dk",
            null,
            "newFrid"
        )
    )
) {
    if (it.isSuccess) {
        //Move a device to a room successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Set Room Order

API

Set the room order and display priority.

kotlin
fun setFamilyRoomSort(
    roomSortList: List<QuecSortDeviceEnterModel>, callback: QuecCallback<Unit>
)

Parameter

ParameterRequiredDescription
roomSortListYRoom array to be sorted.
callbackYCallback function of the request.

QuecSortDeviceEnterModel Definition

FieldTypeDescription
fridStringRoom ID.
roomSortStringRoom order, starting from 0, with the lower numbers at the front of the list, non-consecutive values allowed but duplicate values prohibited.

Example

kotlin
QuecSmartHomeService.setFamilyRoomSort(
    listOf(
        QuecSortDeviceEnterModel("frid1", 0),
        QuecSortDeviceEnterModel("frid2", 1),
    )
) {
    if (it.isSuccess) {
        //Set the room order and display priority successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Query Device List in Room

API

Query device list in a room.

kotlin
fun getFamilyRoomDeviceList(
    frid: String,
    pageNumber: Int,
    pageSize: Int,
    isGroupDeviceShow: Boolean,
    callback: QuecCallback<QuecPageResponse<QuecDeviceModel>>
)

Parameter

ParameterRequiredDescription
fridYRoom ID.
pageNumberNPage number. Default value: 1.
pageSizeNPage size. Default value: 10.
isGroupDeviceShowNWhether to display group devices. Default: Not display
callbackYCallback function of the request.

The QuecDeviceModel Definition is the same as the SDK description in the Device Management section.

Example

kotlin
QuecSmartHomeService.getFamilyRoomDeviceList("frid", 1, 10, true) {
    if (it.isSuccess) {
        val data = it.data //Query device list in a room successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Query Room List in Home

API

Query the room list in a home.

kotlin
fun getFamilyRoomList(
    fid: String,
    pageNumber: Int,
    pageSize: Int,
    callback: QuecCallback<QuecPageResponse<QuecFamilyRoomItemModel>>
)

Parameter

ParameterRequiredDescription
fidYHome ID.
pageNumberNPage number. Default value: 1.
pageSizeNPage size. Default value: 10.
callbackYCallback function of the request.

See QuecFamilyRoomItemModel Definition above.

Example

kotlin
QuecSmartHomeService.getFamilyRoomList("fid", 1, 10) {
    if (it.isSuccess) {
        val data = it.data //Query the room list in a home successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Edit Device Information

API

Edit device information, such as setting the room information and whether the device is commonly used.

kotlin
fun setDeviceInfo(
    modelArray: List<QuecSetDeviceInfoModel>, callback: QuecCallback<QuecFamilySetDeviceModel>
)

Parameter

ParameterRequiredDescription
modelArrayNThe list of devices to be configured with room information.
callbackYCallback function of the request.

QuecSetDeviceInfoModel Definition

FieldTypeDescription
fidStringHome ID.
dkStringDeviceKey.
pkStringProductKey.
deviceNameStringDevice name.
isCommonUsedBOOLWhether the device is commonly used.
true-Commonly used
false-Not commonly used
typeintDevice type.
1-Home device
2-Shared device
3-Multi-bound device
oldFridStringOriginal room ID from which the device is moved out.
selectFridStringNew room ID into which the device is moved.
shareCodeStringShare code.

Example

kotlin
QuecSmartHomeService.setDeviceInfo(
    listOf(
        QuecSetDeviceInfoModel(
            fid = "fid",
            dk = "dk",
            pk = "pk",
            deviceName = "deviceName",
            isCommonUsed = true,
            type = 3
        )
    )
) {
    if (it.isSuccess) {
        //Edit device information successfully.
    } else {
        val code = it.code //Failed. Error code.
    }
}