How can Puck's UART service be connected from node-red ?
I have installed https://www.npmjs.com/package/node-red-contrib-ble-uart and created a sample workflow as suggested, but Puck does not appear. Any thoughts ?
I usually use EspruinoHub to bridge from MQTT.
However one of the steps to set up Noble (the lib that contrib-blue-uart probably uses) is to run the command:
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
Have you done that? It might help? If node doesn't exist you might have to change it to which nodejs
I would like to call a function on Puck from node-red. Am I on the right way with contrib-blue-uart or that could be done with EspruinoHub too ?
Either way will work. contrib-blue-uart is a less Espruino-specific way that doesn't require a separate service, but EspruinoHub will be able to pick up advertising data and report it back via MQTT.
Info on using EspruinoHub to send commands to Puck.js here: http://www.espruino.com/Puck.js+Node-RED
I have used your advises in the link above to build my flows. But now I need to call a function called "myFunc" on the specific Puck and read the result rather than reading the advertised data. How can I do that ?
Ahh - I'm afraid that functionality isn't built in to EspruinoHub yet.
You might be able to do a write to /ble/write/_address_/nus/nus_tx followed by a write (contents don't matter) to /ble/read/_address_/nus/nus_rx after a delay, and then listen on /ble/data/_address_/nus/nus_rx but that would only return the last 18 characters or so of response (plus some formatting characters).
To make it better you could ensure you send "\x10print(your_function())" (that's character code 16 at the start) - which will ensure that the data you receive is only the data your function returned.
However in this case, you're probably better off using contrib-blue-uart - did you get it working?
The advice above ("\x10print(your_function())") will still help you though.
I am using https://www.npmjs.com/package/node-red-contrib-ble-uart
Here on the sample workflow there is a On/Off input to BLE followed by ToString function dumped on the output.
I cannot make it scanning even with the advises above. Once done, how can I send the command to the specific Puck with xx:xx:xx:xx:xx:xx address ?
I've just tried node-red-contrib-ble-uart and node-red-contrib-ble, and I can't make either of them work properly (although node-red-contrib-ble actually looks more promising).
Not sure what to suggest really - you could contact the authors of those modules/post on their GitHub pages? Puck.js is a standard Nordic UART device, so they should definitely be able to work.
No response from both owners of UART modules for node-red. Now complex is that to appear in EspruinoHub ?
It shouldn't be too hard to add - are you interested in trying to do it yourself?
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