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 do JSON.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 do JSON.stringify(msg.payload) and get an actual array.
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.
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.