Skip to content

Home Information

Feature Description

This section introduces how to manage homes, including creating a home, editing home information, deleting a home, and getting a home list.

General Information

kotlin
QuecSmartHomeService

QuecSmartHomeService Class Definition

FieldTypeDescription
enableBOOLWhether to enable home mode.
autoSwitchBOOLWhether to enable home auto-switch.
currentFamilyQuecFamilyItemModelHome information of the current user.
familysList<QuecFamilyItemModelData list of all homes of the current user.
familyInviteListList<QuecInviteItemModel>List of homes to which the current user is invited.

QuecFamilyItemModel Definition

FieldTypeDescription
fidStringHome ID.
familyNameStringHome name.
familyLocationStringHome location.
familyCoordinatesStringLatitude and longitude of the home.
addTimeStringThe time to add the home.
addTimeTsLongThe timestamp to add the home.
memberRoleIntMember role.
1-Home creator
2-Administrator
3-Ordinary member
currentRoomQuecFamilyRoomItemModelInformation of rooms selected by the current family.
roomsList<QuecFamilyRoomItemModel>List of all rooms in the current home.
groupDeviceDeviceNumIntThe number of devices included in a group.
deviceListList<QuecGroupDeviceBean>Device list.

QuecFamilyRoomItemModel Definition

FieldTypeDescription
fridStringRoom ID.
roomNameStringRoom name.
roomSortStringRoom order.

QuecInviteItemModel Definition

FieldTypeDescription
fidStringHome ID.
familyNameStringHome name.
familyLocationStringHome location.
familyCoordinatesStringLatitude and longitude of the home.
addTimeStringThe time to add the home.
addTimeTsLongThe timestamp to add the home.
invalidTimeStringThe time when the user is invited to the home.

Home Mode

Enable/Disable Home Mode

API

Enable or disable the home mode.

kotlin
fun enabledFamilyMode(familyMode: Boolean, callback: QuecCallback<Unit>)

Parameter

ParameterRequiredDescription
familyModeYEnable or disable the home mode.
callbackYCallback function of the request.

Example

kotlin
QuecSmartHomeService.enabledFamilyMode(true) {
    if (it.isSuccess) {
        //Enable the home mode successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Enable/Disable Home Auto-switch

API

Enable or disable the home auto-switch. This feature can only be set after the home mode is enabled. If home auto-switch is enabled, the connected home will be automatically switched when your location changes.

kotlin
fun enabledAutoSwitch(autoSwitch: Boolean, callback: QuecCallback<Unit>)

Parameter

ParameterRequiredDescription
autoSwitchYEnable or disable the home auto-switch.
callbackYCallback function of the request.

Example

kotlin
QuecSmartHomeService.enabledAutoSwitch(true) {
    if (it.isSuccess) {
        //Enable home auto-switch successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Get Home Mode Configuration

API

Query the home mode configuration to check whether the home mode is enabled.

kotlin
fun getFamilyModeConfig(callback: QuecCallback<QuecFamilyModeConfigModel>)

Parameter

ParameterRequiredDescription
callbackYCallback function of the request.

QuecFamilyModeConfigModel Definition

FieldTypeDescription
enabledAutoSwitchBOOLWhether the home auto-switch is enabled.
enabledFamilyModeBOOLWhether the home mode is enabled.

Example

kotlin
QuecSmartHomeService.getFamilyModeConfig {
    if (it.isSuccess) {
        val data = it.data //Query the home mode configuration successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Home Management

Create Home

API

Create a home.

kotlin
fun addFamily(familyParamModel: QuecFamilyParamModel, callback: QuecCallback<Unit>)

Parameter

ParameterRequiredDescription
familyParamModelYHome information.
callbackYCallback function of the request.

QuecFamilyParamModel Definition

FieldTypeDescription
fidStringHome ID. This parameter is required when you edit home information or delete a home, while it can be omitted when you create a home.
familyNameStringHome name. This parameter is required when you create a home, while it is optional when you edit home information.
familyLocationStringHome location. Optional parameter.
familyCoordinatesStringLatitude and longitude of the home. WGS84 coordinate system. Format: 40.759186,-73.928204. Optional parameter.
familyRoomListList<String>Room list. Optional parameter.

Example

kotlin
QuecSmartHomeService.addFamily(
    QuecFamilyParamModel(
        null, "familyName",
        "location name", "110.53263738426125,25.668388834428706", listOf("room1")
    )
) {
    if (it.isSuccess) {
        val data = it.data //Create a home successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Edit Home Information

API

Edit home information.

kotlin
fun setFamily(familyParamModel: QuecFamilyParamModel, callback: QuecCallback<Unit>)

Parameter

ParameterRequiredDescription
familyParamModelYHome information.
callbackYCallback function of the request.

See QuecFamilyParamModel Definition above.

Example

kotlin
val family = getFamilyInfo()    //Get home information from the platform.
family.familyName = "new name"
QuecSmartHomeService.setFamily(family) {
    if (it.isSuccess) {
        //Edit home information successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Delete Home

API

Delete a home.

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

Parameter

ParameterRequiredDescription
fidYHome ID.
callbackYCallback function of the request.

Example

kotlin
QuecSmartHomeService.deleteFamily("fid") {
    if (it.isSuccess) {
        //Delete a home successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Query Current Home

API

Query the current home.

kotlin
fun getCurrentFamily(
    fid: String?, currentCoordinates: String?, callback: QuecCallback<QuecFamilyItemModel>
)

Parameter

ParameterRequiredDescription
fidYHome ID.
currentCoordinatesNCurrent GPS coordinates (WGS84 format): 40.759186, -73.928204. Optional parameter.
callbackYCallback function of the request.

See QuecFamilyItemModel Definition above.

Example

kotlin
QuecSmartHomeService.getCurrentFamily("fid", null) {
    if (it.isSuccess) {
        val data = it.data //Query the current home successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Query Home List

API

Query the home list.

kotlin
fun getFamilyList(
    role: String?,
    pageNumber: Int,
    pageSize: Int,
    callback: QuecCallback<QuecPageResponse<QuecFamilyItemModel>>
)

Parameter

ParameterRequiredDescription
roleNMember role. Separate multiple roles by commas.
1-Home creator
2-Administrator
3-Ordinary member
pageNumberYPage number. Default: 1.
pageSizeYPage size. Default: 10.
callbackYCallback function of the request.

See QuecFamilyItemModel Definition above.

Example

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

Query Device List in Home

API

Query device list in the specified home.

kotlin
fun getFamilyDeviceList(
    params: QuecFamilyDeviceListParamsModel,
    callback: QuecCallback<QuecPageResponse<QuecDeviceModel>>
)

Parameter

ParameterRequiredDescription
paramsYParameters.
callbackYCallback function of the request.

QuecFamilyDeviceListParamsModel Definition

FieldTypeDescription
fidStringHome ID.
isAddOwnerDeviceBOOLWhether to add all your devices. Optional parameter.
deviceNameStringDevice name. Optional parameter.
pageNumberIntPage number. Default: 1. Optional parameter.
pageSizeIntPage size. Default: 10. Optional parameter.
isGroupDeviceShowBOOLWhether to display group devices. This parameter is omitted by default.
isAssociationBOOLWhether to query the unassociated devices. Default value: false.
secondItemCodeStringSecond category. Default value: null.
pkListStringList of ProductKeys to be added. Separate multiple ProductKeys by commas.

Example

kotlin
QuecSmartHomeService.getFamilyDeviceList(
    QuecFamilyDeviceListParamsModel(
        "fid", true, null, 1, 10, true, false, null, null
    )
) {
    if (it.isSuccess) {
        val data = it.data //Query device list in the specified home successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Common Devices

Add Common Device

API

Add a common device or multiple common devices in batches.

kotlin
fun addCommonUsedDevice(
    fid: String, deviceList: List<QuecDeviceEnterModel>, callback: QuecCallback<OperateDeviceListRespModel>
)

Parameter

ParameterRequiredDescription
fidYHome ID.
deviceListYDevice list.
callbackYCallback function of the request.

QuecDeviceEnterModel Definition

FieldTypeDescription
pkStringProductKey.
dkStringDeviceKey.

QuecOperateDeviceRespModel is a generic batch operation response class. You can extract the required properties based on the actual returned parameters.

QuecOperateDeviceRespModel Definition

FieldTypeDescription
successListQuecOperateDeviceRespItemList of successful executions.
failureListQuecOperateDeviceRespItemList of failed executions.

QuecOperateDeviceRespItem Definition

FieldTypeDescription
fidStringHome ID.
oldFridStringOriginal room ID.
nFridStringNew room ID.
pkStringProductKey.
dkStringDeviceKey.
deviceNameStringDevice name.
shareCodeStringShare code.
isCommonUsedBOOLWhether the device is commonly used.
true-Commonly used
false-Not commonly used
msgStringError message (Only valid for failureList).

Example

kotlin
QuecSmartHomeService.addCommonUsedDevice(
    "fid",
    listOf(QuecDeviceEnterModel("dk", "pk"))
) {
    if (it.isSuccess) {
        val data = it.data //Add a common device successfully. 
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Delete Common Device

API

Delete a device or multiple devices in batches.

kotlin
fun deleteCommonUsedDevice(
    fid: String, deviceList: List<CommonDevice>, callback: QuecCallback<OperateDeviceListRespModel>
)

Parameter

ParameterRequiredDescription
fidYHome ID.
deviceListYDevice list.
callbackYCallback function of the request.

See QuecDeviceEnterModel and QuecOperateDeviceRespModel Definition above.

Example

kotlin
QuecSmartHomeService.deleteCommonUsedDevice("fid", listOf(CommonDevice().apply {
    pk = "pk"
    dk = "dk"
})) {
    if (it.isSuccess) {
        val data = it.data //Delete a device successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Query Common Device List

API

Query the list of common devices.

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

Parameter

ParameterRequiredDescription
fidYHome ID.
pageNumberNPage number. Default: 1.
pageSizeNPage size. Default: 10.
isGroupDeviceShowNWhether to display group devices. This parameter is omitted by default.
callbackYCallback function of the request.

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

Example

kotlin
QuecSmartHomeService.getCommonUsedDeviceList("fid", 1, 10, true) {
    if (it.isSuccess) {
        val data = it.data //Query the list of common devices successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Device Group

Query Home Device Group List

API

Query the home device group list.

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

Parameter

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

QuecFamilyDeviceGroupInfoModel Definition

FieldTypeDescription
nameStringGroup name.
fidStringHome ID. This parameter is required when you create a group.
addressStringAddress.
contactPhoneListStringContact person.
coordinateStringLongitude and latitude.
coordinateSystemStringCoordinate system.
descripStringDescription.
managerStringAdministrator.
managerTypeStringAdministrator type.
parentIdStringParent device group ID.
extendStringExtended field.
dgidStringGroup ID.
ownerStringOwner.
addTimeStringThe time to add the group.
addTimeTsLongThe timestamp to add the group.

Example

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

Add Home Device Group

API

Add a home device group.

kotlin
fun addFamilyDeviceGroup(
    groupInfoModel: QuecFamilyDeviceGroupModel, callback: QuecCallback<Unit>
)

Parameter

ParameterRequiredDescription
groupInfoModelYGroup information.
callbackYCallback function of the request.

QuecFamilyDeviceGroupModel Definition

FieldTypeDescription
nameStringHome name.
fidStringHome ID. This parameter is required when you create a group.
addressStringAddress.
contactPhoneListStringContact person.
coordinateStringLongitude and latitude.
coordinateSystemStringCoordinate system.
descripStringDescription.
managerStringAdministrator.
managerTypeStringAdministrator type.
parentIdStringParent device group ID.
extendStringExtended field.

Example

kotlin
QuecSmartHomeService.addFamilyDeviceGroup(
    QuecFamilyDeviceGroupModel(
        name = "name",
        fid = "fid",
    )
) {
    if (it.isSuccess) {
        //Add a home device group successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Query List of Devices not in Home Device Group

API

Query the list of devices that are not in the home device group.

kotlin
fun getDeviceListByNotInDeviceGroup(
    fid: String,
    pageNumber: Int,
    pageSize: Int,
    groupId: String,
    callback: QuecCallback<QuecPageResponse<QuecDeviceModel>>
)

Parameter

ParameterRequiredDescription
fidNHome ID.
pageNumberNPage number. Default: 1.
pageSizeNPage size. Default: 10.
groupIdYDevice group ID.
callbackYCallback function of the request.

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

Example

kotlin
QuecSmartHomeService.getDeviceListByNotInDeviceGroup("fid", 1, 10, "groupId") {
    if (it.isSuccess) {
        val data = it.data //Query the list of devices that are not in the home device group successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}