I am having some trouble using Tuya Smart Life app SDK in my React Native application.
I am using this library to bridge between Tuya's native SDK and React Native.
Using the SDK I successfully created a user, a home and then started the bluetooth scan,in the logs i can see that is discovers my device.After following Tuya Docs i see the discovered device should be returned from the "didDiscoveryDeviceWithDeviceInfo" but it doesn't happen for me.
Not sure if its connected but in the logs i see this:
[ThingRequest] request: domain = a1-us.iotbing.com, url = https://a1-us.iotbing.com/api.json, api =smartlife.m.device.bind.status.get, commonParams = {"lang" : "en","bizData" : "{\"nd\":1,\"customDomainSupport\":\"1\"}","deviceId" : "229A6B7E-D000-46B5-96F7-8FA1D39246F2","et" : "0.0.2","osSystem" : "17.4.1","bundleId" : "com.loopump.app","time" : "1715584371","lon" : 0,"channel" : "sdk","nd" : 1,"appVersion" : "1.0.0","ttid" : "appstore_d","os" : "IOS","v" : "1.1","sid" :"az171557r6264723dJPjtCF38dfad8b6ed4cd012febe985129302799","sign" :"e48995f2513ccefae9936cfe387f3cb100606a3e22bd7a02f07aa6c424dd6f32","platform" : "iPhone 13","requestId" : "326662BA-85AC-4C63-A94B-7D7E77D70E57","sdkVersion" : "5.2.0","timeZoneId" : "Asia\/Manila","lat" : 0,"clientId" : "nwvrfnnvnd5kxvrss55x","deviceCoreVersion" : "5.7.0","a" : "smartlife.m.device.bind.status.get","cp" : "gzip"}, businessParams = {"encryptValue" : "4A536DA0ECEBAEE5",<...>[ThingRequest] response: api = smartlife.m.device.bind.status.get,data = {"success" : false,"errorCode" : "PERMISSION_DENIED","status" : "error","errorMsg" : "No access","t" : 1715584370720}
The device id here is not of the bluetooth device i am trying to pair but its the actual Iphone that is scanning for devices.
This is the Objective-C code that starts the scan and should return the discovered device:
static TuyaBLERNScannerModule * scannerInstance = nil;@interface TuyaBLERNScannerModule()<ThingSmartBLEManagerDelegate>@property(copy, nonatomic) RCTPromiseResolveBlock promiseResolveBlock;@property(copy, nonatomic) RCTPromiseRejectBlock promiseRejectBlock;@end@implementation TuyaBLERNScannerModuleRCT_EXPORT_MODULE(TuyaBLEScannerModule)RCT_EXPORT_METHOD(startBluetoothScan:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter) { if (scannerInstance == nil) { scannerInstance = [TuyaBLERNScannerModule new]; } NSLog(@"DEBUG: startBluetoothScan"); [ThingSmartBLEManager sharedInstance].delegate = scannerInstance; scannerInstance.promiseResolveBlock = resolver; scannerInstance.promiseRejectBlock = rejecter; [[ThingSmartBLEManager sharedInstance] startListening:YES];}- (void)didDiscoveryDeviceWithDeviceInfo:(ThingBLEAdvModel *)deviceInfo { // print device info NSLog(@"DEBUG: %@", [deviceInfo yy_modelToJSONObject]); if (scannerInstance.promiseResolveBlock) { self.promiseResolveBlock([deviceInfo yy_modelToJSONObject]); }}@end
It never reaches the "didDiscoveryDeviceWithDeviceInfo", the logs never logs.