meshtastic/static/documents/mqtt/Flow.txt

1 line
9.8 KiB
Plaintext
Raw Normal View History

[{"id":"10fe1b2e9cb3feb2","type":"decode","z":"23dbb1ee.bc2e8e","name":"decode Protobuf","protofile":"a0d4288141f6a629","protoType":"ServiceEnvelope","x":295.5,"y":285,"wires":[["d3e396cf4f0a9608","d08865b41a69d85d","6f592d47b6a2eac4"]]},{"id":"40c9ee66fe7a34cb","type":"function","z":"23dbb1ee.bc2e8e","name":"function get the message as string from TEXT_MESSAGE_APP","func":"msg.payload = msg.payload.packet.decoded.payload;\n\nlet bufferObj = Buffer.from(msg.payload, \"base64\");\nlet decodedString = bufferObj.toString(\"utf8\");\nmsg.payload = decodedString;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410.5,"y":450,"wires":[["553374591214eaca"]]},{"id":"553374591214eaca","type":"debug","z":"23dbb1ee.bc2e8e","name":"text message out","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":762.5,"y":449,"wires":[]},{"id":"c6afbb9f1665b162","type":"debug","z":"23dbb1ee.bc2e8e","name":"channelId","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":785.5,"y":257,"wires":[]},{"id":"607ef387d5701985","type":"debug","z":"23dbb1ee.bc2e8e","name":"gatewayId","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":792.5,"y":293,"wires":[]},{"id":"d3e396cf4f0a9608","type":"debug","z":"23dbb1ee.bc2e8e","name":"entire payload","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":296.5,"y":247,"wires":[]},{"id":"2339b328bb9bb1d8","type":"comment","z":"23dbb1ee.bc2e8e","name":"Decode all cleartext text and position messages sent by Meshtastic devices into JSON without relying on JSON conversion on the device.","info":"","x":515.5,"y":214,"wires":[]},{"id":"408d796d997bb832","type":"function","z":"23dbb1ee.bc2e8e","name":"function get the nested payload as base64","func":"msg.payload = msg.payload.packet.decoded.payload;\n\nlet bufferObj = Buffer.from(msg.payload, \"base64\");\n//let decodedString = bufferObj.toString(\"hex\");\nmsg.payload = bufferObj;\nmsg.topic=\"\";\n//if you don't zero out the protubufTopic it will try to\n//decode it as part of the mqtt service envelope instead\n//of two-stage decoding\nmsg.protobufType=null;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":349,"y":552,"wires":[["9435a3c605efedb4","1ed6f96c8214d7b3"]]},{"id":"61995c9f8e8266b3","type":"debug","z":"23dbb1ee.bc2e8e","name":"portnum","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":784.5,"y":330,"wires":[]},{"id":"9435a3c605efedb4","type":"debug","z":"23dbb1ee.bc2e8e","name":"nested payload","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":281.5,"y":603,"wires":[]},{"id":"b832775d386f7ac9","type":"mqtt in","z":"23dbb1ee.bc2e8e","name":"","topic":"msh/+/c/#","qos":"2","datatype":"buffer","broker":"37cadac381653b1e","nl":false,"rap":true,"rh":0,"inputs":0,"x":117.5,"y":286,"wires":[["10fe1b2e9cb3feb2"]]},{"id":"d08865b41a69d85d","type":"switch","z":"23dbb1ee.bc2e8e","name":"switch manual decoding nested message based on portum","property":"payload.packet.decoded.portnum","propertyType":"msg","rules":[{"t":"eq","v":"TEXT_MESSAGE_APP","vt":"str"},{"t":"eq","v":"POSITION_APP","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":281.5,"y":505,"wires":[["40c9ee66fe7a34cb"],["408d796d997bb832"]]},{"id":"8abb1bb458af2c4f","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"gatewayId","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1021.5,"y":288,"wires":[[]]},{"id":"1ced0be28eeef0d3","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"latitude","pt":"fl