-
• #2
If you put the message through to the debug node then you'll be able to see what's in it.
At the moment it appears that what you'll be seeing is
{"type":"Buffer","data":[11]}
, so to get the data you need to doJSON.parse(msg.payload).data[0]
.However that was never the intention. If you pull the latest version of EspruinoHub I just fixed it so it reports a JSON array. It means you can check with
msg.payload=="[11]"
or can doJSON.stringify(msg.payload)
and get an actual array. -
• #3
thank you, will try this out
I would like to trigger 2 IFTTT events with my Puck.js, the first IFTTT event, turns on a wifi plug and the second event turns off the wifi plug, all this done in node-red.
I’m using the following code on the Puck.js, it send a different number each time the button is pressed, a 1 or an 11.
in the node-red input mqtt node, I use the following as the Topic:
/ble/advertise/ca:c2:42:7c:05:dc/ffff
using a function node, I was trying to test for the 2 pressCount value I was sending each time I pressed the puck.js
I could not figure how to test for the pressCount value so I ended up testing for the length.
The following is the code I ended up using in the node fuction:
It worked out OK testing for the length, but if someone could show me how I could test for the pressCount value that would be appreciated.
Thanks