Quantcast
Channel: The Things Network - Latest posts
Viewing all articles
Browse latest Browse all 116824

Parsing Semtech LoRaMote data

$
0
0

First best wishes to everybody.

Thank you kdi, that is usefull.

I tried to decode in Node Red (ttb) and now have this flow:
[{"id":"ec1789b3.13e878","type":"mqtt-broker","broker":"croft.thethings.girovito.nl","port":"1883","clientid":""},{"id":"7e854569.817abc","type":"mqtt in","name":"","topic":"nodes/03FF8124/#","broker":"ec1789b3.13e878","x":192,"y":3148,"z":"c3aed0d3.3ce58","wires":[["deb05192.214fb","b022453c.4fddb8"]]},{"id":"deb05192.214fb","type":"debug","name":"","active":false,"console":"false","complete":"true","x":545,"y":3147,"z":"c3aed0d3.3ce58","wires":[]},{"id":"b022453c.4fddb8","type":"function","name":"","func":"var payload = JSON.parse(msg.payload);\nvar decoded_data = new Buffer(payload.data, 'base64');\nreturn decoded_data;\n","outputs":1,"noerr":0,"x":438,"y":3075,"z":"c3aed0d3.3ce58","wires":[["3cb129a1.c34ed6"]]},{"id":"3cb129a1.c34ed6","type":"debug","name":"","active":true,"console":"false","complete":"true","x":627,"y":3074,"z":"c3aed0d3.3ce58","wires":[]}]

The function block has the code:
var payload = JSON.parse(msg.payload);
var decoded_data = new Buffer(payload.data, 'base64');
return decoded_data;

the second line is after your example. :grinning:

this flow yields the exact data sent from my node.

I am a bit surprised I have to use the 'JSON.parse'. without it, the payload is just a flat string.
I was expecting I could do :
var decoded_data = new Buffer(msg.payload.data, 'base64');
but msg.payload doesn't have a data child.
It could be an issue with Node Red. I have the latest version TheThingsBox (1.8.6)
http://thethingbox.io/

anyone else tried this?

grtz, Art


Viewing all articles
Browse latest Browse all 116824

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>