Last Updated on : 2024-06-12 10:22:31download
Multi-control linkage is a device control feature. In this feature, a device data point (DP) is linked with a DP of another device to create a multi-control group. When a device of the multi-control group is controlled, the linked status of other devices in the group is synchronously changed.
For example, 3 two-gang Zigbee sub-device switches, the first DP of each switch is linked with the first DP of the other two switches to create a multi-control group. When the first DP for one of these switches is set to off, the first DP of the other two switches is synchronously set to off.

switch_number and sub_switch_number.IThingDeviceMultiControl iThingDeviceMultiControl = ThingHomeSdk.getDeviceMultiControlInstance();
You can query the multi-control and automation scene data linked with a specified DP of the current device. This device is regarded as the main device and the associated devices are regarded as auxiliary devices.
API description
void getDeviceDpInfoList(String devId, IThingDataCallback<ArrayList<DeviceDpInfoBean>> callback);
Parameters
| Parameter | Description |
|---|---|
| devId | The device ID. |
| callback | The callback. |
Example
IThingDeviceMultiControl iThingDeviceMultiControl =ThingHomeSdk.getDeviceMultiControlInstance();
iThingDeviceMultiControl.getDeviceDpInfoList(mDevId, new IThingDataCallback<ArrayList<DeviceDpInfoBean>>() {
@Override
public void onSuccess(ArrayList<DeviceDpInfoBean> result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
ToastUtil.shortToast(mContext,errorMessage);
}
});
API description
void queryLinkInfoByDp(String devId, String dpId, IThingDataCallback<MultiControlLinkBean> callback);
Parameters
| Parameter | Description |
|---|---|
| devId | The device ID. |
| dpId | The DP ID of the device. |
| callback | The callback. |
Example
iThingDeviceMultiControl.queryLinkInfoByDp(mDevId, dpId, new IThingDataCallback<MultiControlLinkBean>() {
@Override
public void onSuccess(MultiControlLinkBean result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
ToastUtil.shortToast(mContext,errorMessage);
}
});
Fields of MultiControlLinkBean
| Field | Type | Description |
|---|---|---|
| multiGroup | MultiControlLinkBean.MultiGroupBean | The data structure of the associated multi-control group. |
| parentRules | List<MultiControlLinkBean.ParentRulesBean> | The data structure of the associated automation scene. |
Fields of MultiControlLinkBean.MultiGroupBean
| Field | Type | Description |
|---|---|---|
| uid | String | The user ID. |
| groupName | String | The name of the multi-control group. |
| groupType | int | The type of multi-control group. |
| multiRuleId | String | The rule ID. |
| id | int | The multi-control group ID. |
| ownerId | String | The home ID. |
| enabled | Boolean | Specifies whether to enable this multi-control group. |
| status | int | The status of the multi-control group. |
| groupDetail | List |
The details of the multi-control group. |
Fields of GroupDetailBean
| Field | Type | Description |
|---|---|---|
| devId | String | The auxiliary device ID. |
| dpName | String | The linked DP name of the auxiliary device. |
| multiControlId | int | The multi-control group ID. |
| dpId | int | The linked DP ID of the auxiliary device. |
| devName | String | The name of the auxiliary device. |
| enabled | Boolean | Indicates whether the associated auxiliary device can be controlled with a multi-control linkage. |
| status | int | The status of the multi-control group. |
| datapoints | List |
The DP data. |
Fields of MultiControlDataPointsBean
| Field | Type | Description |
|---|---|---|
| code | String | The DP identifier denoted by dpCode of the device. |
| dpId | int | The DP ID. |
| name | String | The name of the DP. |
Fields of ParentRulesBean
| Field | Type | Description |
|---|---|---|
| id | String | The automation scene ID. |
| name | String | The name of the automation scene. |
API description
void getMultiControlDeviceList(long mHomeId, IThingDataCallback<ArrayList<MultiControlDevInfoBean>> callback);
Parameters
| Parameter | Description |
|---|---|
| mHomeId | The home ID. |
| callback | The callback. |
Example
iThingDeviceMultiControl.getMultiControlDeviceList(Constant.HOME_ID, new IThingDataCallback<ArrayList<MultiControlDevInfoBean>>() {
@Override
public void onSuccess(ArrayList<MultiControlDevInfoBean> result) {
iMultiControlDeviceView.setData(result);
}
@Override
public void onError(String errorCode, String errorMessage) {
ToastUtil.shortToast(mContext,errorMessage);
}
});
Fields of MultiControlDevInfoBean
| Field | Type | Description |
|---|---|---|
| productId | String | The product ID. |
| devId | String | The device ID. |
| iconUrl | String | The URL of a device icon. |
| name | String | The name of the device. |
| roomName | String | The name of a room. |
| inRule | Boolean | Indicates whether the device is linked with the main device. |
| datapoints | List |
The DP data. |
API description
GroupDetail must include information about the main device.MultiControlBean. You implement the following features with MultiControlBean:
GroupDetail to an empty value.void saveDeviceMultiControl(long mHomeId, MultiControlBean multiControlBean, IThingResultCallback<MultiControlBean> callback);
void saveDeviceMultiControl(long mHomeId, String json, IThingResultCallback<MultiControlBean> callback);
Parameters
| Parameter | Description |
|---|---|
| mHomeId | The home ID. |
| MultiControlBean | The data structure of the multi-control group. |
| json | The data structure of the multi-control group. |
| callback | The callback. |
The following code block shows the full data structure in the JSON format:
{
"groupName":"Multi-control group 1",
"groupType":1,
"groupDetail":[{"devId":"adadwfw3e234ferf41","dpId":2, "id":22, "enable":true}],
"id":22 // The multi-control group ID.
}
groupType must be 1.
Example
iThingDeviceMultiControl.saveDeviceMultiControl(Constant.HOME_ID, multiControlBean, new IThingResultCallback<MultiControlBean>() {
@Override
public void onSuccess(MultiControlBean result) {
ToastUtil.shortToast(mContext,"success");
}
@Override
public void onError(String errorCode, String errorMessage) {
ToastUtil.shortToast(mContext,errorMessage);
}
});
Fields of MultiControlBean
| Field | Type | Optional | Description |
|---|---|---|---|
| groupName | String | Yes | The name of the multi-control group. |
| groupType | int | No | The type of multi-control group. The value is 1. |
| groupDetail | List |
Yes | The device details of the multi-control group. |
| id | int | Yes | The multi-control group ID. |
API description
void enableMultiControl(long multiControlId, IThingResultCallback<Boolean> callback);
void disableMultiControl(long multiControlId, IThingResultCallback<Boolean> callback);
Parameters
| Parameter | Description |
|---|---|
| multiControlId | The multi-control group ID. |
| callback | The callback. |
Example
iThingDeviceMultiControl.enableMultiControl(id, new IThingResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
ToastUtil.shortToast(mContext,"success");
}
@Override
public void onError(String errorCode, String errorMessage) {
ToastUtil.shortToast(mContext,errorMessage);
}
});
iThingDeviceMultiControl.disableMultiControl( id, new IThingResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
ToastUtil.shortToast(mContext,"success");
}
@Override
public void onError(String errorCode, String errorMessage) {
ToastUtil.shortToast(mContext,errorMessage);
}
});
API description
void getDeviceDpLinkRelation(String devId, IThingDataCallback<DeviceMultiControlRelationBean> callback);
Parameters
| Parameter | Description |
|---|---|
| devId | The device ID. |
| callback | The callback. |
Example
iThingDeviceMultiControl.getDeviceDpLinkRelation(devId, new IThingDataCallback<DeviceMultiControlRelationBean>() {
@Override
public void onSuccess(DeviceMultiControlRelationBean result) {
L.d("MultiControlDeviceListPresenter",result.toString());
}
@Override
public void onError(String errorCode, String errorMessage) {
ToastUtil.shortToast(mContext,errorMessage);
}
});
Fields of DeviceMultiControlRelationBean
| Field | Type | Description |
|---|---|---|
| datapoints | List |
The DP data. |
| mcGroups | List |
The details of the associated multi-control group. |
| parentRules | List |
The details of the associated automation scene. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback