Unable to pair Bluetooth Smart Lights

App development related product technical discussions, including OEM App, App SDK, device control interface development, mini program development and other topics.


Post Reply
a1y1ng
Posts: 3

I compiled and run successfully the source code from github at https://github.com/tuya/tuya-home-andro ... ample-java. However, I could not pair the Bluetooth Smart Lights with the following product parameters:
Base: E27 E26 B22
RGB: 2700K-6500K

When I tried Bluetooth scanning, specifically from these lines:
ThingHomeSdk.getBleOperator().startLeScan(scanSetting, bean -> {
Log.d(TAG, "扫描结果:" + bean.getUuid());
scanDeviceBeanList.add(bean);
getDeviceInfo(bean);
});

It doesn't print out anything though the debug mode is turned on with ThingHomeSdk.setDebugMode(true).
May I know if I need to set any configuration in Tuya development platform? Or do I have to activate official edition in order to do device pairing?

hackill
Posts: 6

Re: Unable to pair Bluetooth Smart Lights

Bluetooth scanning requires necessary permissions. You can refer to the guidance document to determine whether the necessary permissions have been granted.

see:
https://developer.tuya.com/en/docs/app- ... v7r2ju4c21

Another situation is that even if all the permissions have been granted, the device needs to be in the state of activation before it appears in the callback, and the callback returns nearby devices in the activation state.

Tuya App SDK Developer

a1y1ng
Posts: 3

Re: Unable to pair Bluetooth Smart Lights

Based on the log, the bluetooth scan is enabled. Please take a look:

08-18 17:59:42.947 7121 7121 D Thing : thingble_Config_Scanner startScanWith startScanWith: request = {ScanRequest@8573ebf duration=60000, type=ADD, reqTag=BLEConfigScanner}
08-18 17:59:42.947 7121 7121 D Thing : thingble_ThingBleScanner startLeScan: delta = 50492
08-18 17:59:42.947 7121 7121 D Thing : thingble_Config_Scanner onScanStart() called
08-18 17:59:42.947 7121 7121 D Thing : thingble_ThingBleScanner addScanRequest: request = {ScanRequest@8573ebf duration=60000, type=ADD, reqTag=BLEConfigScanner}, time = 60000,size = 1
08-18 17:59:42.947 7121 7121 E Thing : thingble_BleScanner startLeScan: already scanning
08-18 17:59:42.949 2761 2888 V BtGatt.GattService: Skipping data matching denylist: ScanRecord [mAdvertiseFlags=-1, mServiceUuids=null, mServiceSolicitationUuids=[], mManufacturerSpecificData={76=[2, 21, 80, 118, 92, -73, -39, -22, 78, 33, -103, -92, -6, -121, -106, 19, -92, -110, -92, -71, 108, 30, -50]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null, mTransportBlocks=[]]
08-18 17:59:42.949 2761 2888 I BtGatt.GattService: Skipping client for location deny list
08-18 17:59:42.949 2761 2888 V BtGatt.GattService: Skipping data matching denylist: ScanRecord [mAdvertiseFlags=-1, mServiceUuids=null, mServiceSolicitationUuids=[], mManufacturerSpecificData={76=[2, 21, 80, 118, 92, -73, -39, -22, 78, 33, -103, -92, -6, -121, -106, 19, -92, -110, -92, -71, 108, 30, -50]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null, mTransportBlocks=[]]
08-18 17:59:42.949 2761 2888 I BtGatt.GattService: Skipping client for location deny list
08-18 17:59:42.949 2761 2888 V BtGatt.GattService: Skipping data matching denylist: ScanRecord [mAdvertiseFlags=-1, mServiceUuids=null, mServiceSolicitationUuids=[], mManufacturerSpecificData={76=[2, 21, 80, 118, 92, -73, -39, -22, 78, 33, -103, -92, -6, -121, -106, 19, -92, -110, -92, -71, 108, 30, -50]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null, mTransportBlocks=[]]
08-18 17:59:42.949 2761 2888 I BtGatt.GattService: Skipping client for location deny list
08-18 17:59:42.949 2761 2888 V BtGatt.GattService: Skipping data matching denylist: ScanRecord [mAdvertiseFlags=-1, mServiceUuids=null, mServiceSolicitationUuids=[], mManufacturerSpecificData={76=[2, 21, 80, 118, 92, -73, -39, -22, 78, 33, -103, -92, -6, -121, -106, 19, -92, -110, -92, -71, 108, 30, -50]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null, mTransportBlocks=[]]
08-18 17:59:42.949 2761 2888 I BtGatt.GattService: Skipping client for location deny list
08-18 17:59:42.950 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x1a, addressType=1, address=53A9EA_F, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-88, periodicAdvInt=0x0
08-18 17:59:42.951 2761 2778 D BluetoothAdapterService: getBondedDevices, remove custom devices:
08-18 17:59:42.952 7121 7121 I Thing : thingble_BLESystemBondedScanner no bonded devices
08-18 17:59:42.968 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x1b, addressType=1, address=65B15A_9, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-80, periodicAdvInt=0x0
08-18 17:59:42.975 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x10, addressType=1, address=DC234F_5, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-52, periodicAdvInt=0x0
08-18 17:59:43.024 1209 1239 I Light : light data = 31.000000 .
08-18 17:59:43.031 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x10, addressType=1, address=DC234F_5, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-53, periodicAdvInt=0x0
08-18 17:59:43.062 1209 1239 I Accelerometer: acc data x = -0.321000, y = 4.403000, z = 8.399000 .
08-18 17:59:43.099 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x10, addressType=1, address=28A0E7_7, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-41, periodicAdvInt=0x0
08-18 17:59:43.102 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x10, addressType=1, address=234A46_C, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-77, periodicAdvInt=0x0
08-18 17:59:43.115 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x10, addressType=1, address=DC234F_5, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-53, periodicAdvInt=0x0
08-18 17:59:43.162 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x1b, addressType=1, address=6196DE_2, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-48, periodicAdvInt=0x0
08-18 17:59:43.164 1600 1619 I GestureDetector: handleMessage TAP
08-18 17:59:43.165 1600 1600 I GestureDetector: handleMessage TAP
08-18 17:59:43.165 981 1053 I libPerfCtl: xgfGetFPS pid:-1 fps:0
08-18 17:59:43.165 981 1053 I libPerfCtl: xgfGetFPS ioctl_ret:-1
08-18 17:59:43.165 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x10, addressType=1, address=DC234F_5, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-62, periodicAdvInt=0x0
08-18 17:59:43.168 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x1b, addressType=1, address=7CFB1C_9, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-74, periodicAdvInt=0x0
08-18 17:59:43.182 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x1b, addressType=1, address=6D8539_C, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-91, periodicAdvInt=0x0
08-18 17:59:43.200 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x1b, addressType=1, address=7916E7_C, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-84, periodicAdvInt=0x0
08-18 17:59:43.206 2761 2888 D BtGatt.GattService: onScanResult to scannerId: 6- eventType=0x10, addressType=1, address=DC234F_5, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-62, periodicAdvInt=0x0

Based on the log, can you find the root cause?

a1y1ng
Posts: 3

Re: Unable to pair Bluetooth Smart Lights

And also, I can actually add the light bulb using official tuya app. So I'm not sure if the source code in tuya-home-android-sdk-sample-java is really working.

hackill
Posts: 6

Re: Unable to pair Bluetooth Smart Lights

If the tuya app works, it indicates that the device is working properly.

There was no error detected in the logcat output. I'm now checking if the demo code is working as intended.

Tuya App SDK Developer

hackill
Posts: 6

Re: Unable to pair Bluetooth Smart Lights

I checked the code in the demo and ran it again, and it works normally. Looking at the log you provided, it can be seen that the scan has worked. Then you can assist with other operations.

  1. The targetSdkVersion of the demo is lower than 31, and the demo is not compatible with android 12.

  2. Install the Bluetooth debugging tool nrf-connect, use this tool to see if your light bulb device is scanned, and make sure that the device is not connected by other apps or mobile phones when the light bulb is using the demo.

  3. If none of the above works, can you provide a video? The video includes scanning to the device using the Tuya app and do not click. Use the demo to scan at this time.

Tuya App SDK Developer

lilia
Posts: 11

Re: Unable to pair Bluetooth Smart Lights

Hi! Is there any update on this one? Did it work for you?

Post Reply