Cannot discover a Tuya powered bluetooth device using Tuya Smart Life app SDK in a React Native environment

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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>[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
}
</code>
<code>[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 } </code>
[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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>static TuyaBLERNScannerModule * scannerInstance = nil;
@interface TuyaBLERNScannerModule()<ThingSmartBLEManagerDelegate>
@property(copy, nonatomic) RCTPromiseResolveBlock promiseResolveBlock;
@property(copy, nonatomic) RCTPromiseRejectBlock promiseRejectBlock;
@end
@implementation TuyaBLERNScannerModule
RCT_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
</code>
<code>static TuyaBLERNScannerModule * scannerInstance = nil; @interface TuyaBLERNScannerModule()<ThingSmartBLEManagerDelegate> @property(copy, nonatomic) RCTPromiseResolveBlock promiseResolveBlock; @property(copy, nonatomic) RCTPromiseRejectBlock promiseRejectBlock; @end @implementation TuyaBLERNScannerModule RCT_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 </code>
static TuyaBLERNScannerModule * scannerInstance = nil;

@interface TuyaBLERNScannerModule()<ThingSmartBLEManagerDelegate>

@property(copy, nonatomic) RCTPromiseResolveBlock promiseResolveBlock;
@property(copy, nonatomic) RCTPromiseRejectBlock promiseRejectBlock;

@end

@implementation TuyaBLERNScannerModule

RCT_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.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật