5 seconds is to long for my project to get a advertisement.
I experimented with timeout parms on this functions, but it did not affected anything.
Please help?
Too long or too short? Can you show the code where you pass the timeout value?
Older Homeyâs have a 30 second delay, so HP2023 is an improvement, and I think the actual delay was 10 seconds.
All you can do is contact Athom and explain the issue.
The problem is Homey is no constantly listening and tracking BLE notifications, so they have to choose a period to listen for when you request a discovery to be able to detect anything.
I did put in a request a long time ago to be able to register for notifications when a BLE device broadcast a new message. I was informed it would never happen for old Homeyâs but would be considered for HP2023. That doesnât mean it will happen, but if enough developers request it, then maybe it will take a higher priority.
I feel the intention was only to ever connect to devices and register for notifications, but it seems most devices donât allow permanent connections, which makes that useless.
// 1, 10, 1000, 20000, -1000 etc
const advertisements = await this.homey.ble.discover([â0000fd3000001000800000805f9b34fbâ], 1000);
const advertisement = await this.homey.ble.find(âc904dd7b51dfâ, 1000);
Timeout is in milliseconds, so 1000 is one second.
I know, but it stays 5 seconds.
Ah yes, the documentation is broken, thereâs a hardcoded timeout of 5 seconds in Homeyâs core
https://apps.developer.homey.app/wireless/bluetooth
Yes found the note, thanks robertklep.
I use the Eufycan with bold smartlock, but 5 seconds aditional after face recognition is to mutch
WebSocket call: 42/devkit,7[âeventâ,{âsessionIdâ:âdevkit-nl.domain.test1-1.0.0-cc266abeâ,âtypeâ:ârequestâ,âuriâ:âhomey:manager:bleâ,âeventâ:âconnectâ,âdataâ:{âperipheralUuidâ:âf905dd7b61dfâ}}]
I am not a javascript expert and i dont know how to debug it, but when Uuid is known then it is must be possible to create adverticement from scratch?
var advertisement = new Homey.BleAdvertisement();
advertisement.uuid = âf905dd7b61dfâ
var peripheral = advertisement.connect();
// Work to do
(await peripheral).disconnect();
Thatâs not a JS question per se, but a Homey SDK question.
In short: you canât create BLE Advertisement objects manually, you have to use either .discover()
or .find()
: BleAdvertisement - Homey Apps SDK v3
The advertisement.connect() creates the websocket call, and the only property to get the peripheral is the Uuid, advertisement is not needed, my problem is that i dont know witch props needed to create advertisement from scratch.
The WebSocket message is internal to the SDK, you canât (or shouldnât) use it manually. Same as with advertisements: you canât (or shouldnât) instantiate them manually.