First off, I appreciate this is an issue with Noble rather than Espruino/Pucks but I thought asking here might be more fruitful than raising an issue on GitHub as someone may have similar experience.
I have several Pis setup around the house as satellites for an unrelated project and a Pi 4 as a master device on my entertainment unit. The case I'm using for the Pi 4 does a cracking job of nullifying the Bluetooth signal... Therefore, I set up a relay script of sorts that runs on some of the satellite devices picking up the advertiserments of the Pucks I have around the home using Abandonware/Noble, and they feed into the master device over Wifi.
Several weeks ago I did a fresh install of, what is now Raspberry Pi OS on a Pi3 located in my conservatory. After a period of time, several hours, 1 day, 2 days, but no more than 3 days the Pi stops "receiving" the advertisements. Noble reports no state change, there's no errors and no advertisements. Nothing. As soon as I restart the script, Noble reconnects and all works again.
My script is stored on a NAS and is used by all of the satellites with no problems whatsoever. Any other satellite and it wouldn't be an issue, but typically this particular Pi is picking up a Puck that no other Pi can reliably receive.
Has anyone has similar issues using Abandonware/Noble or EspurinoHub (as I believe that uses Noble too) recently? My feeling is it's driver related... I'm not sure what I can check, or what I should look for to help diagnose.
One thing that might help is stopping the system Bluetooth (sudo /etc/init.d/bluetooth stop). I think what can happen is the system starts its own scan for available Bluetooth devices, then stop scanning when it's finished, which stops Noble's scan.
sudo /etc/init.d/bluetooth stop
You could also try handling the scanStop event and using it to start scanning again? https://github.com/noble/noble/blob/master/README.md#scan-stopped
Thanks for your thoughts Gordon.
I should have been clearer when I said there's no change to state. I added handles for stateChange and scanStop to write to a log because that too was my first thought. However, as said, nothing.
State change: poweredOn
That's a shame - in EspruinoHub we actually detect if no advertising data has been received for a while and restart if not. You could do that?
It might work just to try calling startScanning again if no advertising has been received for a while?
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem