Removing negative latitude and longitude coordinates

Yes @hotNipi you are right second packet contains battery,x-axis,y-axis and speed details.Can you seprate these using flows so that i am only getting single latitude and longitude coordinates in debug window.And if possible show details of second packet in another debug node so that it gets properly understandable.
you can use my broker settings
mqtt broker-maqiatto.com
port-1883
username-bachloo.rahul@gmail.com
password-ryanrahul
topic-bachloo.rahul@gmail.com/test

Due the strict security rules I'm not allowed to make connections to public brokers that way.

Have you tried setting the mqtt node to output parsed json and look at what you then receive?

Here's how to separate by packet type

[{"id":"99b86a91.cc8f18","type":"inject","z":"84fee844.7cf2a8","name":"test data AgH5e5xFaIdRRA==","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"data\":\"AgH5e5xFaIdRRA==\"}","payloadType":"json","x":300,"y":260,"wires":[["88fc873f.c086c8"]]},{"id":"b4228108.10405","type":"debug","z":"84fee844.7cf2a8","name":"BASE 64","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":280,"wires":[]},{"id":"2057e639.f3a49a","type":"debug","z":"84fee844.7cf2a8","name":"RESULT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":900,"y":520,"wires":[]},{"id":"88fc873f.c086c8","type":"base64","z":"84fee844.7cf2a8","name":"","action":"","property":"payload.data","x":500,"y":300,"wires":[["b4228108.10405","397b6f6a.a5146"]]},{"id":"2bb51028.cbdab","type":"buffer-parser","z":"84fee844.7cf2a8","name":"long-lat","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatle","name":"lat","offset":2,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"floatle","name":"lon","offset":6,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"object","resultTypeType":"output","multipleResult":false,"setTopic":false,"x":820,"y":420,"wires":[["2057e639.f3a49a"]]},{"id":"4fdac2b4.7bb0ac","type":"inject","z":"84fee844.7cf2a8","name":"test data AgIAZmbmPhNGvwE=","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"data\":\"AgIAZmbmPhNGvwE=\"}","payloadType":"json","x":290,"y":340,"wires":[["88fc873f.c086c8"]]},{"id":"397b6f6a.a5146","type":"buffer-parser","z":"84fee844.7cf2a8","name":"type","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"byte","name":"type","offset":1,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload.packetType","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":570,"y":360,"wires":[["da285ef1.0aeb6"]]},{"id":"3ca2685f.a7b978","type":"debug","z":"84fee844.7cf2a8","name":"TYPE SELECTED","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.packetType","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":360,"wires":[]},{"id":"da285ef1.0aeb6","type":"switch","z":"84fee844.7cf2a8","name":"type of packet","property":"payload.packetType.type","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":620,"y":420,"wires":[["3ca2685f.a7b978","2bb51028.cbdab"],["3ca2685f.a7b978"]]}]

thank you @hotNipi but could you explain your flow :blush:for me to better understand.how am i able to seprate out packets of type 1 and type 2 in my case.In your example i am getting latitude and longitude for both packets type1 as well as type 2.But as per my use case I want just type 1 object should send latitude and longitude.And type 2 object can send battery level speed,x axis,y axis etc .This is a 9 axis sensor allso which i forgot to mention.

I'll take it back. That way you'll get wrong results. Needs a bit more clear thinking ...

Try this. Might be better.

Edit. As I never had any need to use the buffer-parser node :+1: before, I took a time to play with it to educate myself. Made example a bit more complete and added comments at some areas. Still no clue if it works with live data but according to documents, it should.

[{"id":"99b86a91.cc8f18","type":"inject","z":"84fee844.7cf2a8","name":"test data AgH5e5xFaIdRRA==","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"data\":\"AgH5e5xFaIdRRA==\"}","payloadType":"json","x":220,"y":100,"wires":[["88fc873f.c086c8"]]},{"id":"88fc873f.c086c8","type":"base64","z":"84fee844.7cf2a8","name":"","action":"","property":"payload.data","x":440,"y":120,"wires":[["397b6f6a.a5146"]]},{"id":"2bb51028.cbdab","type":"buffer-parser","z":"84fee844.7cf2a8","name":"long-lat","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatle","name":"lat","offset":2,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"floatle","name":"lon","offset":6,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"object","resultTypeType":"output","multipleResult":false,"setTopic":false,"x":340,"y":260,"wires":[["ef285a08.57fab8"]]},{"id":"4fdac2b4.7bb0ac","type":"inject","z":"84fee844.7cf2a8","name":"test data AgIAZmbmPhNGvwE=","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"data\":\"AgIAZmbmPhNGvwE=\"}","payloadType":"json","x":210,"y":140,"wires":[["88fc873f.c086c8"]]},{"id":"397b6f6a.a5146","type":"buffer-parser","z":"84fee844.7cf2a8","name":"type","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"byte","name":"totalPackets","offset":0,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"byte","name":"currentPacket","offset":1,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload.packetType","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":430,"y":180,"wires":[["6d8643ba.4f766c"]]},{"id":"9990fd58.bbf2a","type":"buffer-parser","z":"84fee844.7cf2a8","name":"battery/speed","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"byte","name":"battery","offset":2,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"floatle","name":"speed","offset":3,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"int16le","name":"xaxis","offset":7,"length":1,"offsetbit":0,"scale":4,"mask":""},{"type":"int16le","name":"yaxis","offset":9,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"object","resultTypeType":"output","multipleResult":false,"setTopic":false,"x":360,"y":300,"wires":[["2801a984.3ce1a6"]]},{"id":"6d8643ba.4f766c","type":"switch","z":"84fee844.7cf2a8","name":"","property":"payload.packetType.currentPacket","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":190,"y":280,"wires":[["2bb51028.cbdab"],["9990fd58.bbf2a"]]},{"id":"ef285a08.57fab8","type":"function","z":"84fee844.7cf2a8","name":"floatToGPScoord","func":"function floatToGPScoord(num) {\n    var d = parseInt (num / 100)\n    var m = parseInt(num) - (d*100)\n    var s = num -  parseInt(num)\n    var coord = d+((m+s)/60)\n    return coord\n}\nvar out = {}\nout.payload = {}\nout.payload.lat = floatToGPScoord(msg.payload.lat.value);\nout.payload.lon = floatToGPScoord(msg.payload.lon.value);\nout.topic = 'coordinates'\n\nreturn out;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":260,"wires":[["829f858e.2e6bd8"]]},{"id":"2801a984.3ce1a6","type":"function","z":"84fee844.7cf2a8","name":"speed and battery","func":"var bat = msg.payload.battery.value == 0 ? 'OK' : 'LOW'\nvar speed = parseFloat((msg.payload.speed.value * 1.852).toFixed(2))\nvar x = msg.payload.xaxis.value/100\nvar y = msg.payload.yaxis.value/100\nvar out = {}\nout.payload = {}\nout.payload.battery = bat\nout.payload.speed = speed\nout.payload.speedUnit = \"km/h\"\nout.payload.xaxis = x\nout.payload.yaxis = y\nout.topic = 'info'\n\nreturn out;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":300,"wires":[["829f858e.2e6bd8"]]},{"id":"829f858e.2e6bd8","type":"join","z":"84fee844.7cf2a8","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":750,"y":280,"wires":[["149d9612.519bfa"]]},{"id":"149d9612.519bfa","type":"debug","z":"84fee844.7cf2a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":870,"y":280,"wires":[]},{"id":"d54af413.ddb908","type":"comment","z":"84fee844.7cf2a8","name":"determine packet type","info":"[LW001-BG Datasheet EN V1.3](http://doc.mokotechnology.com/index.php?s=/2&page_id=143)\n### total packets\n`01\t| 0x02`   \nthe total packets of uplink data, all the complete data packet are 2\n\n### current packet\n`02\t| 0x01, 0x02`\t\nthe number of current packet ","x":650,"y":180,"wires":[]},{"id":"707a3e54.9e848","type":"comment","z":"84fee844.7cf2a8","name":"switch by packet type","info":"### first output\nPacket type 1 (coordinates)\n\n### second output\nPacket type 2 (speed, battery, movement)","x":140,"y":320,"wires":[]},{"id":"1cb263f4.6d54fc","type":"comment","z":"84fee844.7cf2a8","name":"parse different packets","info":"[LW001-BG Datasheet EN V1.3](http://doc.mokotechnology.com/index.php?s=/2&page_id=143)\n\n\n# node  **long-lat**\n### latitude\n`03-06\t| 0x00000000-0xFFFFFFFF`\t\nLatitude is represented by the 4-byte float of the IEEE 754 standard, and the byte order is low byte first. The format is ddmm.mmmm when the float converted to decimal data keep four decimal places. Convert to decimal data is positive, representing north latitude (N). otherwise, it means southern latitude (S)\n\n### longitude\n`07-10\t| 0x00000000-0xFFFFFFFF`\t\nLongitude is represented by the 4-byte float of the IEEE 754 standard, and the byte order is low byte first. The format is dddmm.mmmm when the float converted to decimal data keep four decimal places. converted to decimal positive, to represent the east longitude (E); otherwise, it means western longitude (W)\n\n# node **battery/speed**\n### battery level\n`03\t| 0x00,0X01`\t\nthe current battery level,00 indicate normal battery,01 indicate low battery,it can only send one or two hundred pieces of data\n\n### speed\t\n`04-07\t| 0x000000-0xFFFFFF`  \nspeed is represented by the 4-byte float of the IEEE 754 standard, and the byte order is low byte first. when the float converted to decimal data keep four decimal places","x":340,"y":360,"wires":[]},{"id":"36a5a7ae.a329b8","type":"comment","z":"84fee844.7cf2a8","name":"format by the rules","info":"Set also topic for each stream to be able to join those streams together propely","x":550,"y":360,"wires":[]},{"id":"66580505.81cc8c","type":"comment","z":"84fee844.7cf2a8","name":"LoraWan GPS Tracker LW001-BG data parsing","info":"Data is coming in two consecutive messages via MQTT.\n","x":420,"y":40,"wires":[]}]
2 Likes

@hotnipi second inject node doesn't inject any payload.I tried ur flow it works well but there are some fixes which it requires inorder to use with mqtt node.



First Data Packet from mqtt broker

{"applicationID":"1","applicationName":"cloud","data":"AgEteDBFu0zvRQ==","devEUI":"24e124fffef0a78e","deviceName":"lw001","fCnt":69,"fPort":8,"rxInfo":[{"altitude":0,"latitude":0,"loRaSNR":1.8,"longitude":0,"mac":"24e124fffef0a78e","name":"24e124fffef0a78e","rssi":-97,"time":"2020-11-02T08:30:44.904551Z"}],"time":"2020-11-02T08:30:44.904551Z","txInfo":{"adr":true,"codeRate":"4/5","dataRate":{"bandwidth":125,"modulation":"LORA","spreadFactor":7},"frequency":868300000}}

2nd data packet from mqtt broker

{"applicationID":"1","applicationName":"cloud","data":"AgIAzcxMPdxFeAE=","devEUI":"24e124fffef0a78e","deviceName":"lw001","fCnt":70,"fPort":8,"rxInfo":[{"altitude":0,"latitude":0,"loRaSNR":0.8,"longitude":0,"mac":"24e124fffef0a78e","name":"24e124fffef0a78e","rssi":-98,"time":"2020-11-02T08:30:48.254505Z"}],"time":"2020-11-02T08:30:48.254505Z","txInfo":{"adr":true,"codeRate":"4/5","dataRate":{"bandwidth":125,"modulation":"LORA","spreadFactor":7},"frequency":868300000}}

In your original flow you had function node after the MQTT in node.
It probably was there to parse out the data portion from the full message. You cant feed full data to base64 node.
image

yes @hotnipi even with that also i tried but there is some problem.

[{"id":"5ee4bb60.5fa454","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"aa04e1e3.15a72","type":"inject","z":"5ee4bb60.5fa454","name":"test data AgH5e5xFaIdRRA==","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"data\":\"AgH5e5xFaIdRRA==\"}","payloadType":"json","x":180,"y":80,"wires":[["bfb91dcc.3b512"]]},{"id":"bfb91dcc.3b512","type":"base64","z":"5ee4bb60.5fa454","name":"","action":"","property":"payload.data","x":400,"y":120,"wires":[["9cafc1df.04f83"]]},{"id":"3f447056.b3c8a","type":"buffer-parser","z":"5ee4bb60.5fa454","name":"long-lat","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatle","name":"lat","offset":2,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"floatle","name":"lon","offset":6,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"object","resultTypeType":"output","multipleResult":false,"setTopic":false,"x":300,"y":260,"wires":[["ad6e7414.a78378"]]},{"id":"4cbb5b99.403184","type":"inject","z":"5ee4bb60.5fa454","name":"test data AgIAZmbmPhNGvwE=","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"data\":\"AgIAzcxMPdxFeAE=\"}","payloadType":"json","x":150,"y":140,"wires":[["bfb91dcc.3b512"]]},{"id":"9cafc1df.04f83","type":"buffer-parser","z":"5ee4bb60.5fa454","name":"type","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"byte","name":"totalPackets","offset":0,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"byte","name":"currentPacket","offset":1,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload.packetType","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":390,"y":180,"wires":[["f4a9ea77.e34848"]]},{"id":"53edb508.9ea11c","type":"buffer-parser","z":"5ee4bb60.5fa454","name":"battery/speed","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"byte","name":"battery","offset":2,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"floatle","name":"speed","offset":3,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"int16le","name":"xaxis","offset":7,"length":1,"offsetbit":0,"scale":4,"mask":""},{"type":"int16le","name":"yaxis","offset":9,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"object","resultTypeType":"output","multipleResult":false,"setTopic":false,"x":320,"y":300,"wires":[["dd2e9709.f51ca8"]]},{"id":"f4a9ea77.e34848","type":"switch","z":"5ee4bb60.5fa454","name":"","property":"payload.packetType.currentPacket","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":150,"y":280,"wires":[["3f447056.b3c8a"],["53edb508.9ea11c"]]},{"id":"ad6e7414.a78378","type":"function","z":"5ee4bb60.5fa454","name":"floatToGPScoord","func":"function floatToGPScoord(num) {\n    var d = parseInt (num / 100)\n    var m = parseInt(num) - (d*100)\n    var s = num -  parseInt(num)\n    var coord = d+((m+s)/60)\n    return coord\n}\nvar out = {}\nout.payload = {}\nout.payload.lat = floatToGPScoord(msg.payload.lat.value);\nout.payload.lon = floatToGPScoord(msg.payload.lon.value);\nout.topic = 'coordinates'\n\nreturn out;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":260,"wires":[["7d59d61a.b4c048"]]},{"id":"dd2e9709.f51ca8","type":"function","z":"5ee4bb60.5fa454","name":"speed and battery","func":"var bat = msg.payload.battery.value == 0 ? 'OK' : 'LOW'\nvar speed = parseFloat((msg.payload.speed.value * 1.852).toFixed(2))\nvar x = msg.payload.xaxis.value/100\nvar y = msg.payload.yaxis.value/100\nvar out = {}\nout.payload = {}\nout.payload.battery = bat\nout.payload.speed = speed\nout.payload.speedUnit = \"km/h\"\nout.payload.xaxis = x\nout.payload.yaxis = y\nout.topic = 'info'\n\nreturn out;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":300,"wires":[["7d59d61a.b4c048"]]},{"id":"7d59d61a.b4c048","type":"join","z":"5ee4bb60.5fa454","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":710,"y":280,"wires":[["e4bc0e89.b1836"]]},{"id":"e4bc0e89.b1836","type":"debug","z":"5ee4bb60.5fa454","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":280,"wires":[]},{"id":"2601138.08aabec","type":"comment","z":"5ee4bb60.5fa454","name":"determine packet type","info":"[LW001-BG Datasheet EN V1.3](http://doc.mokotechnology.com/index.php?s=/2&page_id=143)\n### total packets\n`01\t| 0x02`   \nthe total packets of uplink data, all the complete data packet are 2\n\n### current packet\n`02\t| 0x01, 0x02`\t\nthe number of current packet ","x":610,"y":180,"wires":[]},{"id":"f32f002b.f3aaf","type":"comment","z":"5ee4bb60.5fa454","name":"switch by packet type","info":"### first output\nPacket type 1 (coordinates)\n\n### second output\nPacket type 2 (speed, battery, movement)","x":100,"y":320,"wires":[]},{"id":"82d81f3.bda35e","type":"comment","z":"5ee4bb60.5fa454","name":"parse different packets","info":"[LW001-BG Datasheet EN V1.3](http://doc.mokotechnology.com/index.php?s=/2&page_id=143)\n\n\n# node  **long-lat**\n### latitude\n`03-06\t| 0x00000000-0xFFFFFFFF`\t\nLatitude is represented by the 4-byte float of the IEEE 754 standard, and the byte order is low byte first. The format is ddmm.mmmm when the float converted to decimal data keep four decimal places. Convert to decimal data is positive, representing north latitude (N). otherwise, it means southern latitude (S)\n\n### longitude\n`07-10\t| 0x00000000-0xFFFFFFFF`\t\nLongitude is represented by the 4-byte float of the IEEE 754 standard, and the byte order is low byte first. The format is dddmm.mmmm when the float converted to decimal data keep four decimal places. converted to decimal positive, to represent the east longitude (E); otherwise, it means western longitude (W)\n\n# node **battery/speed**\n### battery level\n`03\t| 0x00,0X01`\t\nthe current battery level,00 indicate normal battery,01 indicate low battery,it can only send one or two hundred pieces of data\n\n### speed\t\n`04-07\t| 0x000000-0xFFFFFF`  \nspeed is represented by the 4-byte float of the IEEE 754 standard, and the byte order is low byte first. when the float converted to decimal data keep four decimal places","x":300,"y":360,"wires":[]},{"id":"c48c5e7f.58b7e","type":"comment","z":"5ee4bb60.5fa454","name":"format by the rules","info":"Set also topic for each stream to be able to join those streams together propely","x":510,"y":360,"wires":[]},{"id":"71a3437a.9451dc","type":"comment","z":"5ee4bb60.5fa454","name":"LoraWan GPS Tracker LW001-BG data parsing","info":"Data is coming in two consecutive messages via MQTT.\n","x":380,"y":40,"wires":[]},{"id":"95b2adfb.aeed8","type":"mqtt in","z":"5ee4bb60.5fa454","name":"","topic":"bachloo.rahul@gmail.com/test","qos":"0","datatype":"auto","broker":"c44802ed.2f5f7","x":440,"y":40,"wires":[["9e9027e8.2dd5d8"]]},{"id":"9e9027e8.2dd5d8","type":"function","z":"5ee4bb60.5fa454","name":"","func":"var t=JSON.parse(msg.payload);\nmsg.name = t.name;\nmsg.payload=t.data;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":480,"y":80,"wires":[["bfb91dcc.3b512"]]},{"id":"c44802ed.2f5f7","type":"mqtt-broker","name":"","broker":"maqiatto.com","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

here is my complete flow with function node added.

this is output after adding function node

In the function node you are creating the payload like this:
image

But the base64 expects the input from msg.payload.data

image

Fix even one or another.

so i will try injecting directly from mqtt node to base 64 node. this is the output

I told that you can't connect it directly. You'll need to filter out proper portion of the data from full message.
Read again my previous explanation what was wrong.


this is the output i am getting

The output is different so what have you changed?

@hotnipi this is ur flow only i have just added mqtt and function node only.i am testing the mqtt broker node with ur flow

You have changed something even in function or in base64 node. Show how they are configured. And put debug node after the function node and after the base64 node.
I cant guess what is wrong. Also you shouldn't guess. Do debugging.

And nothing is wrong with the first buffer-parser. The error is self explanatory. The input is bad.


@hotnipi i have not changed anything.this type node is part of ur flow which u shared for seprating different packets based on packet number.

Change the MQTT in node to output parsed JSON object
image

And remove the function node.

After changing mqtt node to parsed json object this output