Zigbee Sub-Device
Sub-Device network distribution means that smart devices rely on the hub to connect to Aqara. Therefore, the process of Sub-Device network distribution must be specific to a certain hub, and the hub completes device activation and message notification.
Device Pairing process
Flow Description:
- Query the hub that supports the Sub-Device under the current account.
- Select the hub, send data to let the hub enter the device pairing state.
- The Sub-Device is successfully configured, and the hub sends data to the Aqara cloud platform.
- Query the device pairing results from the Aqara cloud platform.
1. Start Sub-Device Device Pairing
Interface Description
+ (void)requestCanJoinGatewayFromWithIndex:(NSInteger)index pageSize:(NSInteger)pageSize model:(NSString *)model positionId:(NSString *)positionId comletion:(void (^)(id result, NSError *error))completion;
Parameter Description
Parameter | Description |
---|---|
index | Start page |
pageSize | Paging Size |
model | The value of the Sub-Device model that needs to be configured |
positionId | Home ID, obtained from the Aqara developer platform |
completion | Method callback |
Example:
[LMAccessNetRequest requestCanJoinGatewayFromWithIndex:0 pageSize:100 model:@"model.xxxxx.xxx" positionId:@"home.id" comletion:^(id _Nonnull result, NSError * _Nonnull error) {
}];
2.Stop Device Pairing
Interface Description
+ (void)sendCancelAppPermisionToGateway:(NSString *)did completion:(void (^)(id response, NSError *error))completion;
Parameter Description | Parameter | Description | |---|---| |did|Hub ID| |completion|Method callback|
Example:
[LMAccessNetRequest sendCancelAppPermisionToGateway:did completion:nil];
3. Query Device Pairing Results
Interface Description
+ (void)queryChildDeviceAccessNetResultWithGatewayDid:(NSString *)did completion:(void (^)(id response, NSError *error))completion;
Parameter Description | Parameter | Description | |---|---| |did|Hub ID| |completion|Method callback|
Example:
[LMAccessNetRequest queryChildDeviceAccessNetResultWithGatewayDid:@"" completion:^(id _Nonnull response, NSError * _Nonnull error) {
}];
Return parameter description
"result": {
"timeStamp": 1685592290262,
"parentDeviceId": "lumi1.6490c17ac4ec",
"state": 1,
"lang": 1
},
Parameter | Description |
---|---|
state | 0 Successful network configuration 1 No new Sub-Device 2 Abnormal (need to see error information) |
parentDeviceId | Hub ID |