Last Updated on : 2024-11-18 06:40:50download
Routers and Wi-Fi devices that have Pegasus pairing enabled can be used to pair other Wi-Fi devices.
Process
API description
/**
* Get activated devices with lightning activation support.
*
* @param homeId Home id.
* @return Device id list.
*/
TuyaHomeSdk.getActivatorInstance().getSupportLightningActiveDevices(homeId)
Parameters
Parameter | Description |
---|---|
homeId | The home ID. |
Parameters
Parameter | Type | Description |
---|---|---|
devIds | List |
The list of devices that support Pegasus pairing. |
serverTimeout | long | The timeout value for the server to search for devices to be paired. Unit: seconds. |
clientTimeout | long | The timeout value for the client. Unit: seconds. |
ITuyaLightningSearchListener | Callback | The callback. |
Example
TuyaHomeSdk.getActivatorInstance().newLightningActivator().startSearch(devList, serverTimeout, clientTimeout, new ITuyaLightningSearchListener() {
@Override
public void onSearchResponse(LightningSearchBean bean) {
// The search result.
}
});
ITuyaLightningActivator.stopSearch();
Parameter | Type | Description |
---|---|---|
devList | List |
The list of discovered devices that support Pegasus pairing. |
ITuyaLightningActivator.cancel(devList);
Process
Before the Pegasus pairing process, the SDK must get a pairing token from the cloud in the networked state. The token is valid for 10 minutes and expires immediately after the device is paired. A new token must be generated if the device needs to be paired again.
Parameters
Parameter | Type | Description |
---|---|---|
homeId | String | The home ID. For more information, see Home Management. |
Example
TuyaHomeSdk.getActivatorInstance().getActivatorToken(homeId, new ITuyaActivatorGetToken() {
@Override
public void onSuccess(String token) {
}
@Override
public void onFailure(String errorCode, String errorMsg) {
}
});
Parameters
Parameter | Type | Description |
---|---|---|
lightningSearchBeanList | List |
The list of discovered devices that support Pegasus pairing. |
token | String | The pairing token. |
timeout | Int | The timeout value for pairing. Unit: seconds. Recommended value: 120 . |
ITuyaDevActivatorListener | Callback | The callback of the pairing result. |
Example
TuyaHomeSdk.getActivatorInstance()
.newLightningActivator()
.startActive(new TuyaLightningDevActivatorBuilder()
.setLightningSearchBeanList(lightningSearchBeans)
.setTimeOut(60 * 1000)
.setToken(token)
.setListener(new ITuyaDevActivatorListener() {
@Override
public void onError(String errorCode, String errorMsg) {
}
@Override
public void onActiveSuccess(DeviceBean devResp) {
}
}));
ITuyaLightningActivator.stopActive();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback