-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OpenHaystack (AirTag)] Module "ble_advert" not found #3667
Comments
@gfwilliams we have the |
Thanks for the report!
You need to upload it to Storage with the filename ... but you shouldn't have to do that! Looks like this would have started with bcc5ae9 which is actually one of your commits @bobrippling ? I doubt this has ever worked since that change. The App Loader parses and handles modules for any file uploaded with a '.js' extension in the url - but there was no URL specified for the file so it just copied it in verbatim. I've just pushed a fix which supplies a URL which even though it's not used and wouldn't work anyway fools the app loader into parsing the file. Just FYI, I'm not sure where you saw those |
Thank you both for the fast replies and fixes!
You are right - I saved the file with a ".js" extension before and that was my mistake. Uploading it manually made the errors go away.
The errors occured but if I recall correctly it then prompted that the minified file was loaded anyways. Unfortunately I still can't get it to work... The key is not picked up by the apple network. I assume that the MAC address of my Bangle2 does not stay "static" as I see changing MAC addresses when I connect the app loader or IDE. The key I'm using is working with my FlipperZero over an anisette-v3-server and FindMy - I've tested that before. |
Well, as soon as the code for OpenHaystack is run (right after boot) the Mac should be set to what's needed for the beacon. So you might see the Mac address come up for a fraction of a second as the old (original) one but I think after that it should stay as the right one? But I do wonder whether those changes that were made might have broken it somehow. Were you able to test it when you made the changes @bobrippling? It might be interesting to connect with the Web IDE and write the old code to
|
Yes I have a horrible feeling something's broken - I'll test with the old code too and see if I get any reports coming through |
I tried it yesterday and here is what I've found:
but
I will look into how the payload for ble advertisement is formed in openhaystack and compare if I identify any differences. Maybe something changed there as well with byte-sequences etc. which might be the cause of the signal not getting picked up. |
I think that's probably a sign that there's been an error while executing the code (so maybe there was some typo when you pasted it into the IDE?) - if you reload it with the IDE connected I'd hope it would tell you what the error was if there was one. |
There was indeed an error which I was able to solve. However the MAC does not stay the same with the Bangle but keeps changing after I upload the key. I analyzed both payloads and the ble advertisement is identically (no error there). So I'd assume that the reason it is not working is that the bangle still changes its MAC eventhough it is not supposed to :( |
That's really strange. Can you put your finger on when the Bangle changes MAC address? Like when you change apps, or just seemingly randomly? And does it change just between two MAC addresses, or multiple different ones? |
So I tried to go with a clean uninstall/install but still can't figure out why the signal is not picked up by the FindMy network. All it ever states is: "BLE connected, queuing BLE restart for When your changes in the Git Repo are pushed to the official bangle app website I'll gladly give it another try... In the meantime someone else can maybe test if it is working for them or if they are having similar issues?! 😕 |
That's what you'd expect - it can't change some things while the BLE connection is active as it has to restart the bluetooth stack for them. It's not possible you're just constantly staying connected to the Bangle so it's not getting a chance to advertise is it? |
Negative, I did disconnect. Tried it once the app was updated, disconnected and then held the button to reload and vice versa. Still the same outcome. |
To double-check, is this with the code revert to before bcc5ae9? |
I tried both actually, the NRF.setAdvertising and require("ble_advert") and they didn't work for me :/ |
Interesting - have you seen it working in the past, ever? If not, it could be that your watch isn't being picked up by any devices capable of adding it to the FindMy network |
Similarly - I haven't been able to get my watch on the network for a while (#3566), perhaps something's up |
The key(s) - yes. If I add them to my FlipperZero they get picked up in an instance by the FindMy network. With the Bangle however they were never picked up. Is there a way to troubleshoot the MAC address setting on the bangle? I checked BLE with a BLE scanner and the payload for advertising the key is the same as e.g. with the FlipperZero. It just seems that the MAC still keeps on changing. |
Yes, I see the same - I wonder if the advertisement has to be stable/unchanging for a certain duration before it'll be accepted? I've bumped the advertising interval on mine and confirmed there's 5 seconds while a MAC is used. Will see if it gets picked up: {
const key = E.toUint8Array(atob("...")); // public key
const mac = [ key[0] | 0b11000000, key[1], key[2], key[3], key[4], key[5] ].map(x => x.toString(16).padStart(2, '0')).join(':'); // mac address
const adv = [ 0x1e, 0xff, 0x4c, 0x00, 0x12, 0x19, 0x00, key[6], key[7], key[8], key[9], key[10], key[11], key[12], key[13], key[14], key[15], key[16], key[17], key[18], key[19], key[20], key[21], key[22], key[23], key[24], key[25], key[26], key[27], key[0] >> 6, 0x00 ]; // advertising packet
NRF.setAddress(mac);
//require("ble_advert").push(adv, {whenConnected: true, interval: 1000}); // advertise AirTag *and* normal device name (to remain connectable)
-NRF.setAdvertising([adv,{}],{whenConnected: true, interval: 1000}); // advertise AirTag *and* normal device name (to remain connectable)
+NRF.setAdvertising([adv,{}],{whenConnected: true, interval: 5000}); // advertise AirTag *and* normal device name (to remain connectable)
} |
No reports - I suspect the issue isn't the Do you see any difference in the BLE reports from your FlipperZero vs the Bangle? I see the advertisements parsed as FindMy reports in NRF Connect, with the public key payload matching my public key |
Here is what the FlipperZero advertises
and here the Bangle
The differences I see:
The broadcast intervall on the Flipper can be manually set anywhere between 1-10 sec. Other than that the keys are identitical. |
Do you think one of you could send me a key from OpenHaystack to test? privately if you want. I'm pretty sure the interval shouldn't have any effect - once the advertising is set it'll stay as is. I just tested on a Bangle here for the MAC address - I uploaded But you're saying that yours does change - what kind of addresses does the MAC address change between? Maybe you could try uploading a file called:
Then reload and see what's printed. Maybe also try with the Open Haystack app removed. It will throw an exception so it may break what's running, but it will give you a stack trace of where setAddress was called from Interesting about the A0/00 - that's a trivial change to make and might help I guess? |
but I don't know what that means... However there is no error when openhaystack is not installed. |
It's hard to be 100% sure, but the line
So it'll run openhaystack without issues - then leave the bangle for a bit and play around, and see if it gets called any other time with anything else?
Thanks! |
I see exactly the same - different devices show up, sometimes unidentified rather than @gfwilliams let me know if you want another public key to test with and I'll whizz mine over
This could be a point |
I've found the website but the byte A0/00 is part of the "Status byte" and not the "company identifier" if I interpret it correctly. So this change might really be worth a try. |
But is it just two addresses? Or more than two? Because that's exactly what you would expect - the Bangle's own address from before the MAC address is set (which may happen for a fraction of a second at boot or before you long-press to reload apps after installing OpenHaystack) and then the new address you set.
It's really not helping to debug this when you appear to be changing keys between posting up and also blanking out your full key and MAC address. But I used the key you gave and what I see here is... I pasted in the
So it appears to all be doing the correct thing as far as I can tell. And both the example bits of code I mentioned for OpenHaystack report 0x121900 too. So honestly I'm not really sure what the difference would be, unless Apple have now started filtering devices that also advertise other information (like their name) as well as the AirTag packet. |
Affected hardware version
Bangle 2
Your firmware version
2v24
The bug
When I try to install 'OpenHaystack (AirTag)' with a valid advertisement key via the app loader on my Bangle 2 I get the following error:
"Uncaught Error: Module "ble_advert" not found at line 23 col 21 in .boot0"
I suppose that the "ble_advert" package is not available anymore or at least faulty. My Console prompts this:
Loading modules
loadModule(ble_advert)
ERROR: getURL("https://www.espruino.com/modules/ble_advert.min.js") error : HTTP 404
ERROR: getURL("https://www.espruino.com/modules/ble_advert.js") error : HTTP 404
ERROR: getURL("https://banglejs.com/apps/modules/ble_advert.min.js") error [object ProgressEvent]
I tried to manually add the module via "require("ble_advert")" and require("https://raw.githubusercontent.com/espruino/BangleApps/refs/heads/master/modules/ble_advert.js") within the IDE but it failed to RAM and FLASH. When trying to FLASH I needed to factory reset my bangle 2 because it always gets stuck on the Bluetooth loading screen.
Installed apps
No response
The text was updated successfully, but these errors were encountered: