Open redoz opened 1 year ago
Can anyone at Athom say anything about this? Is this expected behavior?
Looking at the actual implementation:
if (event === 'find') {
return this.onAppEventFind(data);
}
...
async onAppEventFind({ peripheralUuid }) {
await this.discover();
const peripheral = await this.getPeripheral({ peripheralUuid });
return peripheral.toAppJSON();
}
...
async discover() {
if (!this.__discoverPromise) {
this.__discoverPromise = Promise.resolve().then(async () => {
await Bluez.startDiscovery();
await HomeyUtil.wait(TIMES.ONE_SECOND * 5);
await Bluez.stopDiscovery();
});
this.__discoverPromise
.catch((err) => this.error(`Error Discovering: ${err.message}`))
.finally(() => {
delete this.__discoverPromise;
});
}
await this.__discoverPromise;
}
Which to me looks like a timeout argument on .find()
is just discarded.
Looking at the actual implementation:
if (event === 'find') { return this.onAppEventFind(data); } ... async onAppEventFind({ peripheralUuid }) { await this.discover(); const peripheral = await this.getPeripheral({ peripheralUuid }); return peripheral.toAppJSON(); } ... async discover() { if (!this.__discoverPromise) { this.__discoverPromise = Promise.resolve().then(async () => { await Bluez.startDiscovery(); await HomeyUtil.wait(TIMES.ONE_SECOND * 5); await Bluez.stopDiscovery(); }); this.__discoverPromise .catch((err) => this.error(`Error Discovering: ${err.message}`)) .finally(() => { delete this.__discoverPromise; }); } await this.__discoverPromise; }
Which to me looks like a timeout argument on
.find()
is just discarded.
That was more or less my suspicion as well, thank you!
@robertklep do you work for Athom, or is this source somehow available so I could've found this answer myself?
No, I don't work for Athom 😅 If you jailbreak your Homey you can find the file ManagerBLE.mjs
in /var/lib/docker/overlay2/b8abd68bb4b398dba93cdb5da5da6e32d260bb76d3594d00daf768414f11fb84/diff/app/lib/
Well in that case I owe you a drink of choice, thank you!
Now if only we could get Athom's attention so they could actually fix this 🙄
Edit: I've spent a few hours digging into this, and it seems like the timeout specified isn't respected:
The timeout trips after 5 seconds, even though I passed in a timeout of 15000 milliseconds.
Running on Homey Pro (early 2023) version: 10.0.1-rc.1