And then disconnect from Puck.js, whenever you press the button you'll see a service UUID '0xFFFF' broadcast that has a number in it. Each time the number changes, an MQTT event will get fired, and you can hook on to that in Node-red (by default you'll still get an event fired by EspruinoHub every 60 seconds even it it hasn't changed, but there's a node-red block that'll filter that out by only passing a message when the value changes).
The nice thing about doing it this way is there's no connection, and also if you walk out of range, press the button and then walk back in range, the event will still fire when Puck.js gets back in range
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.
Hi,
The simplest way to do it would be to advertise a 'button press count' variable. If you upload the following:
And then disconnect from Puck.js, whenever you press the button you'll see a service UUID '0xFFFF' broadcast that has a number in it. Each time the number changes, an MQTT event will get fired, and you can hook on to that in Node-red (by default you'll still get an event fired by EspruinoHub every 60 seconds even it it hasn't changed, but there's a node-red block that'll filter that out by only passing a message when the value changes).
The nice thing about doing it this way is there's no connection, and also if you walk out of range, press the button and then walk back in range, the event will still fire when Puck.js gets back in range