This will work for some applications, but most of the scenarios I will be dealing with will involve at least two peripheral devices.
I have another thread on this forum about bluetooth but it was supposed to be for help with a specific node-RED package. It has gone cold despite my efforts to keep it alive. So I figured I would pose the question here. If we find an answer that applies to the other thread I will post a link here.
I have had some success with node-red-contrib-generic-ble
, I can scan, connect, read, and write properly with no issues. However, I ran a few tests and even with reading and writing every minute or so, the device disconnects after about 6 hours and won't reconnect without re-deploying Node-RED. The node seems to have automatic reconnect, as if I turn off the peripheral device it throws an error, but then attempts to reconnect every time I send a read or write command. So adding my own "reconnect" routine doesn't seem to be of any benefit. I'm not seeing any errors on the Arduino or Pi side.
I also have tried node-red-contrib-noble-ble
and node-red-contrib-ble-sense
which have both performed worse.
The former scans, connects, and reads fine, but I can't write to the device. The latter scans and connects fine, but I'm having trouble deciphering the output from the "connect" node. I also haven't figured out a way to write a value.
For anyone interested here is a link to that forum page if you want more details and to troubleshoot my code.