NB-IoT Device Pairing

Last Updated on : 2024-10-09 02:01:35download

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 smart devices more simply and efficiently on already established mobile networks. Smart Life 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.

API description

Parameter Description
apiName tuya.m.qrcode.parse
version 4.0

postData

Parameter Description
code The string of the QR code.

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

        })

Start paring

API description

Parameter Description
apiName tuya.m.nb.device.user.bind
version 1.0

postData

Parameter Description
hid The pairing token.
timeZone The time zone.

getData

Parameter Description
gid The ID of the home with which the device will be bound.

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.nb.device.user.bind", postData: ["hid":id,"timeZone":timezone], getData:["gid":homeId], version: "1.0", success: {_ in

	}, failure: { (Error) in

	})