How to power BLE back on using node-red-contrib-noble-bluetooth

I've managed to get node-red-contrib-noble-bluetooth to scan for BLE devices and subscribe to one devices's characteristics, but I'm having a recurring error that typically requires a reboot of my Raspberry Pi 4. Any ideas how to prevent or catch this error?
Error scanning for devices: Error: Could not start scanning, state is poweredOff (not poweredOn)

I've been able to avoid rebooting in some instances with the following commands in the terminal, but it would be much more useful to catch and correct this from within node-red. Any ideas?

sudo systemctl restart bluetooth.service
sudo systemctl restart nodered.service

I seem to have been able to reduce the occurrence of this error by stopping BLE scanning as soon as a BLE device is connected. I've been reading that some BLE chipsets fail if you attempt to connect to a BLE device while still scanning. I still haven't found a complete solutions, so any tips would be greatly appreciated.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.