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.

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

Parameter

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

Example

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

Edit Room Name

API

Edit a room name.

objc
- (void)setFamilyRoomWithFrid:(NSString *)frid
                     roomName:(NSString *)roomName
                      success:(QuecVoidBlock)success
                      failure:(QuecErrorBlock)failure;

ParameterDescription

ParameterRequiredDescription
fridYRoom ID.
roomNameYRoom name.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

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

Delete Room

API

Delete a room or multiple rooms in batches.

objc
- (void)deleteFamilyRoomsWithIds:(NSArray<NSString *> *)fridList
                         success:(QuecVoidBlock)success
                         failure:(QuecErrorBlock)failure;

ParameterDescription

ParameterRequiredDescription
fridListYRoom ID list.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

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

Move Device to Room

API

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

objc
- (void)addDeviceInFamilyRoomWithDeviceList:(NSArray<QuecAddDeviceEnterModel *> *)deviceList
                                    success:(void(^)(QuecFamilyAddDeviceModel *model))success
                                    failure:(QuecErrorBlock)failure;

ParameterDescription

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

QuecAddDeviceEnterModel Definition

FieldTypeDescription
pkNSStringProductKey.
dkNSStringDeviceKey.
oldFridNSStringOriginal room ID.
nFridNSStringNew room ID.

QuecFamilyAddDeviceModel Definition

FieldTypeDescription
successListNSArray<QuecFamilyAddDeviceListModel *> *List of successful executions.
failureListNSArray<QuecFamilyAddDeviceListModel *> *List of failed executions.

QuecFamilyAddDeviceListModel Definition

FieldTypeDescription
oldFridNSStringOriginal room ID.
nFridNSStringNew room ID.
pkNSStringProductKey.
dkNSStringDeviceKey
codeNSIntegerError code (Only valid for failureList)
NSStringNSStringError message (Only valid for failureList)

Example

objc
QuecAddDeviceEnterModel *addEnterModel = QuecAddDeviceEnterModel.new;
addEnterModel.pk = @"pk";
addEnterModel.dk = @"dk";
addEnterModel.oldFrid = @"old frid";
addEnterModel.nFrid = @"new frid";
[QuecSmartHomeService.sharedInstance addDeviceInFamilyRoomWithDeviceList:@[addEnterModel] success:^(QuecFamilyAddDeviceModel *model) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Set Room Order

API

Set the room order and display priority.

objc
- (void)setFamilyRoomSortWithRoomRortList:(NSArray<QuecSortDeviceEnterModel *> *)roomSortList
                                  success:(QuecVoidBlock)success
                                  failure:(QuecErrorBlock)failure;

ParameterDescription

ParameterRequiredDescription
roomSortListYRoom array to be sorted.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecSortDeviceEnterModel Definition

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

Example

objc
QuecSortDeviceEnterModel *sort0 = QuecSortDeviceEnterModel.new;
sort0.roomSort = @"0";
sort0.frid = @"first frid";
QuecSortDeviceEnterModel *sort1 = QuecSortDeviceEnterModel.new;
sort1.roomSort = @"1";
sort1.frid = @"second frid";
[QuecSmartHomeService.sharedInstance setFamilyRoomSortWithRoomRortList:@[sort0, sort1]
                                                                success:^{
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Query Device List in Room

API

Query device list in a room.

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

ParameterDescription

ParameterRequiredDescription
fridYRoom ID.
pageNumberNPage number. Default value: 1.
pageSizeNPage size. Default value: 10.
isGroupDeviceShowNWhether to display group devices. Default: Not display
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 getFamilyRoomDeviceListWithFrid:@"your frid"
                                                              pageNumber:1
                                                                pageSize:10
                                                       isGroupDeviceShow:YES
                                                                 success:^(NSArray<QuecDeviceModel *> *list, NSInteger total) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];

Query Room List in Home

API

Query the room list in a home.

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

ParameterDescription

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

See QuecFamilyRoomItemModel Definition above.

Example

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

Edit Device Information

API

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

objc
- (void)setDeviceInfoWithModelArray:(NSArray<QuecSetDeviceInfoModel *> *)modelArray
                            success:(void(^)(QuecOperateDeviceRespModel *model))success
                            failure:(QuecErrorBlock)failure;

ParameterDescription

ParameterRequiredDescription
modelArrayNThe list of devices to be configured with room information.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecSetDeviceInfoModel Definition

FieldTypeDescription
fidNSStringHome ID.
dkNSStringDeviceKey.
pkNSStringProductKey.
deviceNameNSStringDevice 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
oldFridNSStringOriginal room ID from which the device is moved out.
selectFridNSStringNew room ID into which the device is moved.
shareCodeNSStringShare code.

Example

objc
QuecSetDeviceInfoModel *setInfoModel = QuecSetDeviceInfoModel.new;
setInfoModel.fid = @"your fid";
setInfoModel.dk = @"dk";
setInfoModel.pk = @"pk";
setInfoModel.deviceName = @"device name";
setInfoModel.isCommonUsed = YES;
setInfoModel.type = 3;
setInfoModel.oldFrid = @"old frid"; /// can be null
setInfoModel.selectFrid = @"select frid";
[QuecSmartHomeService.sharedInstance setDeviceInfoWithModelArray:@[setInfoModel]
                                                            success:^(QuecOperateDeviceRespModel *model) {
    /// Next Action
} failure:^(NSError *error) {
    NSLog(@"check error: %@", error);
}];