Last Updated on : 2024-04-07 08:24:17download
This feature allows users to control the devices in a collection of groups in one go. The control supports on/off, brightness, mode, and color temperature. The following properties of the ThingSmartPackedGroup class can be used to get the status of the current combination group.
Data model of ThingSmartPackedGroup
| Field | Type | Description |
|---|---|---|
| dps | NSDictionary | The data points (DPs) of a device. |
| switchStatus | BOOL | The on/off status. |
| sceneStatus | NSString | The scene mode. Valid values:
|
| workModel | NSString | The working mode. Valid values:
|
| brightPercent | NSInteger | The brightness percentage. Valid values: 0 to 100. |
| temperaturePercent | NSInteger | The color temperature percentage. Valid values: 0 to 100. |
| colorData | NSString | The data of colored light. This API method only works when the combination group stays in colored light mode. The 12-bit data is formatted as hhhhssssvvvv.
ThingLightingColorUtil provides the method decodeNewHsvWithHsvString to decode colorData into an HSV value. |
API description
- (void)publishDps:(NSDictionary *)dps
success:(nullable ThingSuccessHandler)success
failure:(nullable ThingFailureError)failure;
Parameters
| Parameter | Description |
|---|---|
| dps | The DPs of a specified combination group. |
| success | The success callback. |
| failure | The failure callback. |
Sample code
Objective-C:
[self.packedGroup publishDps:@{@"1" : @"1"} success:^(void) {
NSLog(@"success");
} failure:^(NSError *error){
NSLog(@"failure");
}];
API description
- (void)publishSwitchStauts:(BOOL)switchValue
success:(nullable ThingSuccessID)success
failure:(nullable ThingFailureError)failure;
Parameters
| Parameter | Description |
|---|---|
| switchStatus | The on/off status. |
| success | The success callback. |
| failure | The failure callback. |
Sample code
Objective-C:
[self.packedGroup publishSwitchStatus:YES success:^(id result) {
NSLog(@"success");
} failure:^(NSError *error){
NSLog(@"failure");
}];
API description
This API method works only when the combination group stays in scene mode.
- (void)publishSceneStatus:(NSString *)sceneId
success:(nullable ThingSuccessID)success
failure:(nullable ThingFailureError)failure;
Parameters
| Parameter | Description |
|---|---|
| sceneId | The scene ID. Valid values:
|
| success | The success callback. |
| failure | The failure callback. |
Sample code
Objective-C:
[self.packedGroup publishSceneStatus:THING_LIGHTING_SCENE_WORK success:^(id result) {
NSLog(@"success");
} failure:^(NSError *error){
NSLog(@"failure");
}];
API description
- (void)publishWorkMode:(NSString *)workMode
success:(nullable ThingSuccessID)success
failure:(nullable ThingFailureError)failure;
Parameters
| Parameter | Description |
|---|---|
| workMode | The working mode. Valid values:
|
| success | The success callback. |
| failure | The failure callback. |
Sample code
Objective-C:
[self.packedGroup publishWorkMode:THING_LIGHTING_MODE_WHITE success:^(id result) {
NSLog(@"success");
} failure:^(NSError *error){
NSLog(@"failure");
}];
API description
This API method works only when the combination group stays in white light mode.
- (void)publishBrightPercent:(NSInteger)brightPercent
success:(nullable ThingSuccessID)success
failure:(nullable ThingFailureError)failure;
Parameters
| Parameter | Description |
|---|---|
| brightPercent | The brightness percentage. Valid values: 0 to 100. |
| success | The success callback. |
| failure | The failure callback. |
Sample code
Objective-C:
[self.packedGroup publishBrightPercent:100 success:^(id result) {
NSLog(@"success");
} failure:^(NSError *error){
NSLog(@"failure");
}];
API description
This API method works only when the combination group stays in white light mode.
- (void)publishTemperaturePercent:(NSInteger)temperaturePercent
success:(nullable ThingSuccessID)success
failure:(nullable ThingFailureError)failure;
Parameters
| Parameter | Description |
|---|---|
| TemperaturePercent | The color temperature percentage. Valid values: 0 to 100. |
| success | The success callback. |
| failure | The failure callback. |
Sample code
Objective-C:
[self.packedGroup publishTemperaturePercent:100 success:^(id result) {
NSLog(@"success");
} failure:^(NSError *error){
NSLog(@"failure");
}];
API description
This API method works only when the combination group stays in white light mode.
- (void)publishBrightPercent:(NSInteger)brightPercent
temperaturePercent:(NSInteger)temperaturePercent
success:(nullable ThingSuccessID)success
failure:(nullable ThingFailureError)failure;
Parameters
| Parameter | Description |
|---|---|
| brightPercent | The brightness percentage. Valid values: 0 to 100. |
| temperaturePercent | The color temperature percentage. Valid values: 0 to 100. |
| success | The success callback. |
| failure | The failure callback. |
Sample code
Objective-C:
[self.packedGroup publishBrightPercent:100 temperaturePercent:100 success:^(id result) {
NSLog(@"success");
} failure:^(NSError *error){
NSLog(@"failure");
}];
API description
This API method only works when the combination group stays in colored light mode. colors indicates the result string of HSV encoding. ThingLightingAreaHelper provides the method encodeNewHsvWithHue:saturation:brightness: to encode an HSV value into colorData.
- (void)publishColors:(NSString *)colors
success:(nullable ThingSuccessID)success
failure:(nullable ThingFailureError)failure;
Parameters
| Parameter | Description |
|---|---|
| colors | The colored light. |
| success | The success callback. |
| failure | The failure callback. |
Sample code
Objective-C:
[self.packedGroup publishColors:@"" success:^(id result) {
NSLog(@"success");
} failure:^(NSError *error){
NSLog(@"failure");
}];
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback