Hi Everyone,
This must be a simple thing but i can't seem to do it properly...
PROBLEM
- I have the following mqtt message coming from an arduino
10/2/2015, 12:21:57 PMLight Sensor
home/sensors/light/last : msg : object
{ "topic": "home/sensors/light/last", "payload": { "type": "Buffer", "data": [ 49, 53, 50, 0 ] }, "qos": 0, "retain": false, "_topic": "home/sensors/light/last", "_msgid": "c228dec1.3dd72" }
- With payload
"payload": { "type": "Buffer", "data": [ 49, 53, 50, 0 ] }
- I want to convert the payload to a simple string
"payload": "3333"
I have tried converting it using a function, templates, etc, etc but with no success. The string seems to be converted without issues when doing node.log(msg.payload) for example.
Also when concatenating the payload to a string containing an SQL query (inside a function block), the buffer payload doesn't work and the string payload works perfect, although the logged result seems fine once more.
Please if you know how to do this, let me know, your help would be much appreciated!