Last Updated on : 2024-04-03 16:36:25download
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. These features can be controlled after the list of combination groups is obtained.
API description
ILightingGroupPackDpsManager groupPackDpsManager = ThingCommercialLightingGroupPack.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| groupPackBean | The combination group object. |
Example
ILightingGroupPackDpsManager groupPackDpsManager = ThingCommercialLightingGroupPack
.newGroupPackDpsManager(projectId,groupPackBean)
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getDps()
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| groupPackBean | The combination group object. |
Example
String groupDps = ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getDps()
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getSwitchStatus()
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| groupPackBean | The combination group object. |
Example
boolean switchOn = ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getSwitchStatus()
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getBrightPercent()
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| groupPackBean | The combination group object. |
Example
int brightnessPercent = ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getBrightPercent()
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getTemperaturePercent()
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| groupPackBean | The combination group object. |
Example
int temperaturePercent = ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getTemperaturePercent()
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getColorData();
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| groupPackBean | The combination group object. |
Example
String colorData = ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getColorData();
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getSceneStatus();
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| groupPackBean | The combination group object. |
Example
LightDefaultSceneType sceneType = ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getSceneStatus();
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.getCurrentMode();
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| groupPackBean | The combination group object. |
Example
AreaDpMode groupDpMode = ThingCommercialLightingGroupPack
.newGroupPackDpsManager(projectId,groupPackBean)
.getCurrentMode();
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.publishSwitchStatus(boolean status, final IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| status | The on/off status.
|
| callback | The callback. |
Example
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.publishSwitchStatus(true, new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
Three light modes are supported: white light, colored light, and scene, corresponding to the MODE_WHITE_LIGHT, MDOE_COLORFUL_LIGHT, and MODE_SCENE in AreaDpMode.
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.publishWorkMode(AreaDpMode mode, IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| Mode | The light mode. Valid values:
|
| callback | The callback. |
Example
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(projectId,groupPackBean)
.publishWorkMode(AreaDpMode.MODE_WHITE_LIGHT, new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
This operation only applies to the white light mode.
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.publishTemperaturePercent(int value, IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| value | The color temperature, ranging from 0 to 1,000. |
| callback | The callback. |
Example
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(projectId,groupPackBean)
.publishTemperaturePercent(int value, new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
This operation only applies to the scene mode.
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.publishSceneStatus(LightDefaultSceneType type, IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| type | The scene type:
|
| callback | The callback. |
Example
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(projectId,groupPackBean)
.publishSceneStatus(LightDefaultSceneType.WORK, new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
This operation only applies to the colored light mode.
Get the data for the colored light mode through getColorData. This 12-bit data is formatted as hhhhssssvvvv.
hhhh represents the hue value in hex format.ssss represents the saturation value in hex format.vvvv represents the brightness value in hex format.You can convert colorData into HSV values through stringToHSV, as shown below:
public static float[] stringToHSV(String hsv){
int h = Integer.valueOf(hsv.substring(0,4),16);
int s = Integer.valueOf(hsv.substring(4,8),16);
int v = Integer.valueOf(hsv.substring(8,12),16);
return new float[]{(float)h,(float)s,(float)v};
}
You can convert HSV values into colorData through hsvToString, as shown below:
public static String hsvToString(int[] hsv) {
String h = numToHex4(hsv[0]);
String s = numToHex4(hsv[1]);
String v = numToHex4(hsv[2]);
String hhhhssssvvvv = h + s + v;
return hhhhssssvvvv;
}
public static String numToHex4(int num) {
return String.format("%04x", num);
}
API description
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(long projectId,GroupPackBean groupPackBean)
.publishColors(String color, IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| color | The color value, a 16-bit string, in the format of hhhhssssvvvv. |
| callback | The callback. |
Example
ThingCommercialLightingGroupPack
.newGroupPackDpsManager(projectId,groupPackBean)
.publishColors("hhhhssssvvvv", new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback