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

QuecSmartHomeService Class Initialization

objc
+ (instancetype)sharedInstance;

QuecSmartHomeService Class Definition

FieldTypeDescription
enableBOOLWhether to enable home mode.
autoSwitchBOOLWhether to enable home auto-switch.
currentFamilyQuecFamilyItemModelHome information of the current user.
familysNSArray <QuecFamilyItemModel *> *Data list of all homes of the current user.
familyInviteListNSArray <QuecInviteItemModel *> *List of homes to which the current user is invited.

For example, if you want to get the current home information, run the following sample code.

objc
QuecFamilyItemModel *currentFamily = QuecSmartHomeService.sharedInstance.currentFamily;

QuecFamilyItemModel Definition

FieldTypeDescription
fidNSStringHome ID.
familyNameNSStringHome name.
familyLocationNSStringHome location.
familyCoordinatesNSStringLatitude and longitude of the home.
addTimeNSStringThe time to add the home.
addTimeTsNSIntegerThe timestamp to add the home.
memberRoleNSIntegerMember role.
1-Home creator
2-Administrator
3-Ordinary member
currentRoomQuecFamilyRoomItemModelInformation of rooms selected by the current family.
roomsNSArray<QuecFamilyRoomItemModel *> *List of all rooms in the current home.
groupDeviceDeviceNumNSIntegerThe number of devices included in a group.
deviceListNSArray<QuecGroupDeviceBean *> *Device list.

QuecFamilyRoomItemModel Definition

FieldTypeDescription
fridNSStringRoom ID.
roomNameNSStringRoom name.
roomSortNSStringRoom order.

QuecInviteItemModel Definition

FieldTypeDescription
fidNSStringHome ID.
familyNameNSStringHome name.
familyLocationNSStringHome location.
familyCoordinatesNSStringLatitude and longitude of the home.
addTimeNSStringThe time to add the home.
addTimeTsNSIntegerThe timestamp to add the home.
invalidTimeNSStringThe time when the user is invited to the home.

Clear the current home cache data.

objc
- (void)clearFamilyInfos;

Home Mode

Enable/Disable Home Mode

API

Enable or disable the home mode.

objc
- (void)enabledFamilyMode:(BOOL)familyMode success:(QuecVoidBlock)success failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
familyModeYEnable or disable the home mode.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[QuecSmartHomeService.sharedInstance enabledFamilyMode:YES success:^{
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

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.

objc
- (void)enabledAutoSwitch:(BOOL)autoSwitch success:(QuecVoidBlock)success failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
autoSwitchYEnable or disable the home auto-switch.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[QuecSmartHomeService.sharedInstance enabledAutoSwitch:YES success:^{
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Get Home Mode Configuration

API

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

objc
- (void)getFamilyModeConfigWithSuccess:(void(^)(QuecFamilyModeConfigModel *model))success failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
successNCallback function of successful request.
failureNCallback function of failed request.

QuecFamilyModeConfigModel Definition

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

Example

objc
[QuecSmartHomeService.sharedInstance getFamilyModeConfigWithSuccess:^(QuecFamilyModeConfigModel *model) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Home Management

Create Home

API

Create a home.

objc
- (void)addFamilyWithFamilyParamModel:(QuecFamilyParamModel *)familyParamModel success:(QuecVoidBlock)success failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
familyParamModelYHome information.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecFamilyParamModel Definition

FieldTypeDescription
fidNSStringHome ID. This parameter is required when you edit home information or delete a home, while it can be omitted when you create a home.
familyNameNSStringHome name. This parameter is required when you create a home, while it is optional when you edit home information.
familyLocationNSStringHome location. Optional parameter.
familyCoordinatesNSStringLatitude and longitude of the home. WGS84 coordinate system. Format: 40.759186,-73.928204. Optional parameter.
familyRoomListNSArray<NSString *> *Room list. Optional parameter.

Example

objc
QuecFamilyParamModel *paramModel = QuecFamilyParamModel.new;
paramModel.familyName = @"My Smart Family";
[QuecSmartHomeService.sharedInstance addFamilyWithFamilyParamModel:paramModel success:^{
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Edit Home Information

API

Edit home information.

objc
- (void)setFamilyWithFamilyParamModel:(QuecFamilyParamModel *)familyParamModel success:(QuecVoidBlock)success failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
familyParamModelYHome information.
successNCallback function of successful request.
failureNCallback function of failed request.

See QuecFamilyParamModel Definition above.

Example

objc
QuecFamilyParamModel *paramModel = QuecFamilyParamModel.new;
paramModel.fid = @"my fid";
paramModel.familyName = @"My Smart Family";
[QuecSmartHomeService.sharedInstance setFamilyWithFamilyParamModel:paramModel success:^{
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Delete Home

API

Delete a home.

objc
- (void)deleteFamilyWithFid:(NSString *)fid success:(QuecVoidBlock)success failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
fidYHome ID.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[QuecSmartHomeService.sharedInstance deleteFamilyWithFid:@"your fid" success:^{
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Query Current Home

API

Query the current home.

objc
- (void)getCurrentFamilyWithFid:(NSString *)fid
             currentCoordinates:(NSString *)currentCoordinates
                        success:(void(^)(QuecFamilyItemModel *))success
                        failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
fidYHome ID.
currentCoordinatesNCurrent GPS coordinates (WGS84 format): 40.759186, -73.928204. Optional parameter.
successNCallback function of successful request.
failureNCallback function of failed request.

See QuecFamilyItemModel Definition above.

Example

objc
[QuecSmartHomeService.sharedInstance getCurrentFamilyWithFid:@"your fid"
                                              currentCoordinates:@""
                                                         success:^(QuecFamilyItemModel *itemModel) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Query Home List

API

Query the home list.

objc
- (void)getFamilyListWithRole:(NSString *)role
                   pageNumber:(NSInteger)pageNumber
                     pageSize:(NSInteger)pageSize
                      success:(void(^)(NSArray <QuecFamilyItemModel *> *list, NSInteger total))success
                      failure:(QuecErrorBlock)failure;

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.
successNCallback function of successful request.
failureNCallback function of failed request.

See QuecFamilyItemModel Definition above.

Example

objc
[QuecSmartHomeService.sharedInstance getFamilyListWithRole:@"1"
                                                    pageNumber:1
                                                      pageSize:10
                                                       success:^(NSArray<QuecFamilyItemModel *> *list, NSInteger total) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Query Device List in Home

API

Query device list in the specified home.

objc
- (void)getFamilyDeviceListWithModel:(QuecFamilyDeviceListParamsModel *)params
                             success:(void(^)(NSArray <QuecDeviceModel *> *list, NSInteger total))success
                             failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
paramsYParameters.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecFamilyDeviceListParamsModel Definition

FieldTypeDescription
fidNSStringHome ID.
isAddOwnerDeviceBOOLWhether to add all your devices. Optional parameter.
deviceNameNSStringDevice name. Optional parameter.
pageNumberNSIntegerPage number. Default: 1. Optional parameter.
pageSizeNSIntegerPage 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.
secondItemCodeNSStringSecond category. Default value: null.
pkListNSStringList of ProductKeys to be added. Separate multiple ProductKeys by commas.

Example

objc
QuecFamilyDeviceListParamsModel *paramsModel = QuecFamilyDeviceListParamsModel.new;
paramsModel.fid = @"your fid";
paramsModel.isAddOwnerDevice = YES;
paramsModel.isGroupDeviceShow = YES;
paramsModel.pageSize = 10;
paramsModel.pageNumber = 1;
[QuecSmartHomeService.sharedInstance getFamilyDeviceListWithModel:paramsModel
                                                            success:^(NSArray<QuecDeviceModel *> *list, NSInteger total) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Common Devices

Add Common Device

API

Add a common device or multiple common devices in batches.

objc
- (void)addCommonUsedDeviceWithFid:(NSString *)fid
                        deviceList:(NSArray<QuecDeviceEnterModel *> *)deviceList
                           success:(void(^)(QuecOperateDeviceRespModel *respModel))success
                           failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
fidYHome ID.
deviceListYDevice list.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecDeviceEnterModel Definition

FieldTypeDescription
pkNSStringProductKey.
dkNSStringDeviceKey.
typeNSUIntegerCommon device types that are added or deleted.
1-Home devices
2-Shared device
3-Multi-bound device

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
fidNSStringHome ID.
oldFridNSStringOriginal room ID.
nFridNSStringNew room ID.
pkNSStringProductKey.
dkNSStringDeviceKey.
deviceNameNSStringDevice name.
shareCodeNSStringShare code.
isCommonUsedBOOLWhether the device is commonly used.
true-Commonly used
false-Not commonly used
msgNSStringError message (Only valid for failureList).

Example

objc
QuecDeviceEnterModel *enterModel = QuecDeviceEnterModel.new;
enterModel.pk = @"pk";
enterModel.dk = @"dk";
enterModel.type = 3;
[QuecSmartHomeService.sharedInstance addCommonUsedDeviceWithFid:@"your fid" deviceList:@[enterModel] success:^(QuecOperateDeviceRespModel *respModel) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Delete Common Device

API

Delete a device or multiple devices in batches.

objc
- (void)deleteCommonUsedDeviceWithFid:(NSString *)fid
                        deviceList:(NSArray<QuecDeviceEnterModel *> *)deviceList
                           success:(void(^)(QuecOperateDeviceRespModel *respModel))success
                           failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
fidYHome ID.
deviceListYDevice list.
successNCallback function of successful request.
failureNCallback function of failed request.

See QuecDeviceEnterModel and QuecOperateDeviceRespModel Definition above.

objc
QuecDeviceEnterModel *enterModel = QuecDeviceEnterModel.new;
enterModel.pk = @"pk";
enterModel.dk = @"dk";
enterModel.type = 3;
[QuecSmartHomeService.sharedInstance deleteCommonUsedDeviceWithFid:@"your fid" deviceList:@[enterModel] success:^(QuecOperateDeviceRespModel *respModel) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Query Common Device List

API

Query the list of common devices.

objc
- (void)getCommonUsedDeviceListWithFid:(NSString *)fid 
                            pageNumber:(NSInteger)pageNumber
                              pageSize:(NSInteger)pageSize
                     isGroupDeviceShow:(BOOL)isGroupDeviceShow
                               success:(void(^)(NSArray <QuecDeviceModel *> *list, NSInteger total))success
                               failure:(QuecErrorBlock)failure;

Parameter

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

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

Example

objc
[QuecSmartHomeService.sharedInstance getCommonUsedDeviceListWithFid:@"your fid" pageNumber:1 pageSize:10 isGroupDeviceShow:YES success:^(NSArray<QuecDeviceModel *> *list, NSInteger total) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Device Group

Query Home Device Group List

API

Query the home device group list.

objc
- (void)getFamilyGroupListWithFid:(NSString *)fid
                       pageNumber:(NSInteger)pageNumber
                         pageSize:(NSInteger)pageSize
                          success:(void(^)(NSArray <QuecFamilyDeviceGroupInfoModel *> *list, NSInteger total))success
                          failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
fidYHome ID.
pageNumberNPage number. Default: 1.
pageSizeNPage size. Default: 10.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecFamilyDeviceGroupInfoModel Definition

FieldTypeDescription
nameNSStringGroup name.
fidNSStringHome ID. This parameter is required when you create a group.
addressNSStringAddress.
contactPhoneListNSStringContact person.
coordinateNSStringLongitude and latitude.
coordinateSystemNSStringCoordinate system.
descripNSStringDescription.
managerNSStringAdministrator.
managerTypeNSStringAdministrator type.
parentIdNSStringParent device group ID.
extendNSStringExtended field.
dgidNSStringGroup ID.
ownerNSStringOwner.
addTimeNSStringThe time to add the group.
addTimeTsNSIntegerThe timestamp to add the group.

Example

objc
[QuecSmartHomeService.sharedInstance getFamilyGroupListWithFid:@"your fid"
                                                         pageNumber:1
                                                           pageSize:10
                                                            success:^(NSArray<QuecFamilyDeviceGroupInfoModel *> *list, NSInteger total) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Add Home Device Group

API

Add a home device group.

objc
- (void)addFamilyDeviceGroupWithInfo:(QuecFamilyDeviceGroupModel *)groupInfoModel
                             success:(QuecVoidBlock)success
                             failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
groupInfoModelYGroup information.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecFamilyDeviceGroupModel Definition

FieldTypeDescription
nameNSStringHome name.
fidNSStringHome ID. This parameter is required when you create a group.
addressNSStringAddress.
contactPhoneListNSStringContact person.
coordinateNSStringLongitude and latitude.
coordinateSystemNSStringCoordinate system.
descripNSStringDescription.
managerNSStringAdministrator.
managerTypeNSStringAdministrator type.
parentIdNSStringParent device group ID.
extendNSStringExtended field.

Example

objc
QuecFamilyDeviceGroupModel *groupModel = QuecFamilyDeviceGroupModel.new;
groupModel.name = @"group name";
groupModel.fid = @"your fid";
[QuecSmartHomeService.sharedInstance addFamilyDeviceGroupWithInfo:groupModel
                                                              success:^{
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Query List of Devices not in Home Device Group

API

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

objc
- (void)getDeviceListByNotInDeviceGroupWithFid:(NSString *)fid
                                    PageNumber:(NSInteger)pageNumber
                                      pageSize:(NSInteger)pageSize
                                       groupId:(NSString *)groupId
                                       success:(void(^)(NSArray <QuecDeviceModel *> *list, NSInteger total))success
                                       failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
fidNHome ID.
pageNumberNPage number. Default: 1.
pageSizeNPage size. Default: 10.
groupIdYDevice group ID.
successNCallback function of successful request.
failureNCallback function of failed request.

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

Example

objc
[QuecSmartHomeService.sharedInstance getDeviceListByNotInDeviceGroupWithFid:@"your fid"
                                                                     PageNumber:1
                                                                       pageSize:10
                                                                        groupId:@"your groupid"
                                                                        success:^(NSArray<QuecDeviceModel *> *list, NSInteger total) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];