NB-IoT Device Pairing

Last Updated on : 2022-03-03 06:44:42

This topic describes the mode of pairing a narrowband Internet of things (NB-IoT) device based on the low-power wide-area network (LPWAN) radio technology. NB-IoT connects IoT devices more simply and efficiently on already established mobile networks. Smart Residence App SDK provides the capabilities to pair NB-IoT devices. Users scan the QR code of a target device to get the device ID used for pairing.

Query the device ID

Returns the device ID by using the API methods in Common API Methods. The URL obtained after the device QR code is scanned is used as a request parameter.

Parameters

Parameter Description
apiName tuya.m.qrcode.parse
version 4.0
postData @{@“code”:url}

Example

ObjC:

[self.apiRequest requestWithApiName:@"tuya.m.qrcode.parse" postData:@{@"code":url} version:@"4.0" success:^(id result) {

} failure:^(NSError *error) {

}];

Swift:

apiRequest .request(withApiName: "tuya.m.qrcode.parse", postData: ["code":url], version: "4.0", success: {_ in

        }, failure: { (Error) in

        })

Pair devices

Parameters

Parameter Description
apiName tuya.m.nb.device.user.bind
version 1.0
postData @{@“hid”:id,@“timeZone”:TY_TimeDifferenceWithGMT(nil)}
getData @{@“gid”: @(homeId)}

Example

ObjC:

[self.apiRequest requestWithApiName:@"tuya.m.nb.device.user.bind" postData:@{@"hid":id,@"timeZone":timezone} getData:@{@"gid": @(homeId)} version:@"1.0" success:^(id result) {

} failure:^(NSError *error) {

}];

Swift:

apiRequest .request(withApiName: "tuya.m.qrcode.parse", postData: ["hid":id,"timeZone":timezone], getData:["gid":homeId], version: "4.0", success: {_ in

	}, failure: { (Error) in

	})