I need to read a value using a BLE Descriptor (readValue). But it returns a not found condition in an app, but it does not in the devtools. I know devtools is using another API.
Anyone used this BleDescriptor - Homey Apps SDK v3 call in an app and got a result?
Code snippet of the used code… it finds the BLEDescriptor, then the readValue gives an error
Descriptor Not Found: 0000004f0000100080000026bb765291 which is the UUID of the BLEcharacteristic, not the UUID of the BLEdescriptor.
const characteristicInstanceIdUuid = BLEUtils.uuidToNobleUuid(BLEConstants.CharacteristicInstanceIdUuid);
try {
if (!this.peripheral.isConnected) await this.peripheral.connect();
const descriptors = await characteristic.discoverDescriptors();
const descriptor = descriptors.find((d) => {
return d.uuid === characteristicInstanceIdUuid;
});
this.homey.log('Found IID descriptor for', descriptors.length, descriptor);
const data = await descriptor.readValue();
this.homey.log('Read IID', data.readUInt16LE(0));
return data.readUInt16LE(0);
} catch (err) {
this.homey.error('Error getting IID', err);
throw err;
}