I can't find a way to write to a custom service/characteristic exposed on the Puck from Node-RED through EspruinoHub.
However:
Writing from Node-RED to /ble/write/puck/nus/nus_tx through EspruinoHub works
Writing to the custom service/characteristic using nRF Connect app on an Android phone works
The problem only appears when writing to the custom characteristic through EspruinoHub.
It seems it's not related to Node-RED since the same problem appears also when the MQTT message is published using mosquitto_pub.
The format is /ble/write/de:vi:ce:ad:dr/service/characteristic, so you don't have to write to the Nordic UART on Puck.js. You can define your own services and write directly to those.
And publishing to /ble/write/puck/0000aaaa00001000800000805f9b34fb/0000aaa000001000800000805f9b34fb yields:
<Connect> de:vi:ce:ad:dr: Getting Service...
<Connect> de:vi:ce:ad:dr: Disconnecting due to lack of use (after 30 secs)
<Connect> de:vi:ce:ad:dr: Disconnecting.
<Connect> de:vi:ce:ad:dr: Disconnected
Even extending the CONNECTION_TIMEOUT to 30s and the "getting services" timeout to 15s didn't help.
Any ideas?
Is there some interplay between setAdvertising and setServices?
Am I using the wrong format for specifying service/characteristic ID? (Tried short aaaa, long 0000aaaa00001000800000805f9b34fb, hex 0xaaaa, capitalized, non-capitalized, etc.).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I can't find a way to write to a custom service/characteristic exposed on the Puck from Node-RED through EspruinoHub.
However:
/ble/write/puck/nus/nus_tx
through EspruinoHub worksThe problem only appears when writing to the custom characteristic through EspruinoHub.
It seems it's not related to Node-RED since the same problem appears also when the MQTT message is published using
mosquitto_pub
.Following the guidance in https://www.espruino.com/Puck.js+Node-RED ...:
...and the guidance in http://www.espruino.com/Reference#l_NRF_setServices, this is the code I have on the Puck (first part unrelated (?), but adding for completeness):
And publishing to
/ble/write/puck/0000aaaa00001000800000805f9b34fb/0000aaa000001000800000805f9b34fb
yields:Even extending the
CONNECTION_TIMEOUT
to 30s and the "getting services" timeout to 15s didn't help.Any ideas?
Is there some interplay between
setAdvertising
andsetServices
?Am I using the wrong format for specifying service/characteristic ID? (Tried short
aaaa
, long0000aaaa00001000800000805f9b34fb
, hex0xaaaa
, capitalized, non-capitalized, etc.).Environment: