meshtastic/static/documents/mqtt/EncodePositionFlow.txt

1 line
5.1 KiB
Plaintext
Raw Normal View History

2022-11-26 15:18:58 -08:00
[{"id":"32ca608d9e7c5236","type":"inject","z":"23dbb1ee.bc2e8e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":96.5,"y":1952,"wires":[["2b536512e8c7aef2"]]},{"id":"20bbd2d1408b8dc5","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"channelId_outbound","pt":"flow","to":"LongFast","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":772,"y":2027,"wires":[[]]},{"id":"c6cb373157be01d6","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"gatewayId_outbound","pt":"flow","to":"\"!55c7312c\"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":772,"y":2066,"wires":[[]]},{"id":"24199ec7eaf89c1a","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"portnum_outbound","pt":"flow","to":"3","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":774,"y":2106,"wires":[[]]},{"id":"de38ad5ef343623a","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"from_outbound","pt":"flow","to":"1439117612","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":781,"y":2146,"wires":[[]]},{"id":"d435e8abe0852f93","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"to_outbound","pt":"flow","to":"4294967295","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":2188,"wires":[[]]},{"id":"1f8d172708898860","type":"function","z":"23dbb1ee.bc2e8e","name":"Assemble Position protobuf","func":"msg.protobufType=null;\nmsg.payload =\n{\n \"packet\": {\n \"from\": flow.get(\"from_outbound\"),\n \"to\": flow.get(\"to_outbound\"), \n \"decoded\":{\n //how ENUMS are handled here\n //portnum is decoded as string but encoded as number\n //in the encode/decode node-red nodes based on protobuf.js\n \"portnum\": flow.get(\"portnum_outbound\"),\n \"payload\": msg.payload \n } \n },\n\n \"channelId\": flow.get(\"channelId_outbound\"),\n \"gatewayId\": flow.get(\"gatewayId_outbound\"),\n};\nreturn msg;\n//info on how to get json data into protobuf \"bytes\" field\n//https://github.com/protobufjs/protobuf.js/wiki/Changes-in-ProtoBuf.js-3.8","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1086,"y":2019,"wires":[["b8ccf1cfe8bf40a3"]]},{"id":"b8ccf1cfe8bf40a3","type":"encode","z":"23dbb1ee.bc2e8e","name":"","protofile":"a0d4288141f6a629","protoType":"ServiceEnvelope","x":1287,"y":2020,"wires":[["dbc78f035c9c2b56","a002c148f3a06bac"]]},{"id":"03a7e69ca6d471fe","type":"debug","z":"23dbb1ee.bc2e8e","name":"show hex string","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1319,"y":2180,"wires":[]},{"id":"dbc78f035c9c2b56","type":"function","z":"23dbb1ee.bc2e8e","name":"dump payload as hex string","func":"var hex=Buffer.from(msg.payload,\"hex\");\nmsg.payload=hex.toString(\"hex\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1096,"y":2178,"wires":[["03a7e69ca6d471fe"]]},{"id":"2b536512e8c7aef2","type":"function","z":"23dbb1ee.bc2e8e","name":"Inject lat lon alt","func":"msg.payload={\n \"latitudeI\": 399600000,\n \"longitudeI\": -862600000,\n \"altitude\": 100\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":277.5,"y":1953,"wires":[["9443a9a980e54c75"]]},{"id":"9443a9a980e54c75","type":"encode","z":"23dbb1ee.bc2e8e","name":"encode Position as protobuf","protofile":"dbab6472b07929a0","protoType":"Position","x":506,"y":1953,"wires":[["5c36d3a7f4dca14e"]]},{"id":"5c36d3a7f4dca14e","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"nested_outbound","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":776,"y":1952,"wires":[["20bbd2d1408b8dc5","c6cb373157be01d6","24199ec7eaf89c1a","de38a