It won’t let me upload a text file so this is the json code for my latest cleartext flow. For a use case such as yours I use the flow variables as input to a sqlite database (node-red has a nice sqlite node) which functions as a one hour store-forward buffer at times the local mesh mqtt broker can’t get internet access. An alternative would be to use a different broker with store-forward capability built in.
[{"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":369.5,"y":447,"wires":[["eb37fb79a45684db"]]},{"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":964.5,"y":250,"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":970.5,"y":286,"wires":[]},{"id":"d3e396cf4f0a9608","type":"debug","z":"23dbb1ee.bc2e8e","name":"entire payload","active":true,"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 and user messages sent by Meshtastic devices into JSON without relying on JSON conversion on the device.","info":"","x":535.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":292,"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":964.5,"y":322,"wires":[]},{"id":"9435a3c605efedb4","type":"debug","z":"23dbb1ee.bc2e8e","name":"nested payload","active":true,"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"},{"t":"eq","v":"NODEINFO_APP","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":281.5,"y":505,"wires":[["40c9ee66fe7a34cb"],["408d796d997bb832"],["e2ecd1c2a56a4396"]]},{"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":787.5,"y":286,"wires":[["607ef387d5701985"]]},{"id":"1ced0be28eeef0d3","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"latitude","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1119.5,"y":433,"wires":[[]]},{"id":"313fd3cfe6d91850","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"longitude","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1132.5,"y":470,"wires":[["d02e53cdfb565da6"]]},{"id":"33dd43e3c05f826c","type":"geofence","z":"23dbb1ee.bc2e8e","name":"geofence","mode":"circle","inside":"true","rad":69174.91569647488,"points":[],"centre":{"latitude":40.16287050252407,"longitude":-86.60385131835938},"floor":"","ceiling":"","worldmap":true,"outputs":2,"x":1202.5,"y":595,"wires":[[],["4d01eb8f1b31f039"]]},{"id":"d02e53cdfb565da6","type":"function","z":"23dbb1ee.bc2e8e","name":"trigger function to send a mapping point","func":"let lat = parseFloat(flow.get(\"latitude\"));\nlet lon = parseFloat(flow.get(\"longitude\"));\nlat=lat * 0.0000001;\nlon=lon * 0.0000001;\nlet name = flow.get(\"fromGateway\")\n\nmsg={\"payload\":{\"name\":name,\n \"lat\":lat,\n \"lon\":lon,\n \"action\":\"send\",\n \"icon\": \"car\",\n \"label\":name\n }}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1271.5,"y":525,"wires":[["33dd43e3c05f826c","4d01eb8f1b31f039"]]},{"id":"4d01eb8f1b31f039","type":"worldmap","z":"23dbb1ee.bc2e8e","name":"","lat":"40","lon":"-86","zoom":"7","layer":"OSMG","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","showruler":"false","allowFileDrop":"false","path":"/worldmap","overlist":"DR,CO,RA,DN,HM","maplist":"OSMG,OSMC,EsriC,EsriS,EsriT,EsriDG,UKOS","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":1206.5,"y":675,"wires":[]},{"id":"1ed6f96c8214d7b3","type":"decode","z":"23dbb1ee.bc2e8e","name":"decode Position Protobuf","protofile":"dbab6472b07929a0","protoType":"Position","x":658.5,"y":549,"wires":[["db1933ba36503bd9","dad9f487318f21d9"]]},{"id":"db1933ba36503bd9","type":"debug","z":"23dbb1ee.bc2e8e","name":"Position decoded","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":644.5,"y":593,"wires":[]},{"id":"dad9f487318f21d9","type":"function","z":"23dbb1ee.bc2e8e","name":"Split","func":"var lat = { payload: msg.payload.latitudeI };\nvar lon = { payload: msg.payload.longitudeI };\nvar alt = { payload: msg.payload.altitude };\nvar tm = { payload: msg.payload.time };\n\nreturn [lat,lon,alt,tm];","outputs":4,"noerr":0,"initialize":"","finalize":"","libs":[],"x":834.5,"y":501,"wires":[["1ced0be28eeef0d3","8bb97f802662976c"],["313fd3cfe6d91850","c8e135f3e542bb1b"],["602fb2020680280c","05c7099eeaac2eee"],["ed424ae3d45dd2ac","1207605d22edbe7b"]]},{"id":"8bb97f802662976c","type":"debug","z":"23dbb1ee.bc2e8e","name":"lat","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":993.5,"y":546,"wires":[]},{"id":"c8e135f3e542bb1b","type":"debug","z":"23dbb1ee.bc2e8e","name":"lon","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":989.5,"y":581,"wires":[]},{"id":"602fb2020680280c","type":"debug","z":"23dbb1ee.bc2e8e","name":"alt","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":989.5,"y":617,"wires":[]},{"id":"ed424ae3d45dd2ac","type":"debug","z":"23dbb1ee.bc2e8e","name":"time","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":989.5,"y":653,"wires":[]},{"id":"6f592d47b6a2eac4","type":"function","z":"23dbb1ee.bc2e8e","name":"Split Decoded 1","func":"var channelId = { payload: msg.payload.channelId};\nvar gatewayId = { payload: msg.payload.gatewayId};\nvar portnum = { payload: msg.payload.packet.decoded.portnum};\nvar fr= {payload: msg.payload.packet.from};\nvar to = {payload:\"!\"+ msg.payload.packet.to.toString(16)};\n\nreturn [channelId, gatewayId, portnum, fr, to ];","outputs":5,"noerr":0,"initialize":"","finalize":"","libs":[],"x":577.5,"y":294,"wires":[["a5018a9be0780e79"],["8abb1bb458af2c4f"],["fda2292412d2ea1c"],["fd881fac22422773","a389f9875da672ec"],["956f09c1a5f85180"]]},{"id":"fd881fac22422773","type":"debug","z":"23dbb1ee.bc2e8e","name":"from","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":772.5,"y":358,"wires":[]},{"id":"cf066ad415df30ae","type":"debug","z":"23dbb1ee.bc2e8e","name":"to","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":956.5,"y":395,"wires":[]},{"id":"a389f9875da672ec","type":"change","z":"23dbb1ee.bc2e8e","name":"set flow.from","rules":[{"t":"set","p":"from","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":973.5,"y":358,"wires":[["8242dccd2239136b"]]},{"id":"e2ecd1c2a56a4396","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":286,"y":649,"wires":[["12780b55bd9472c1"]]},{"id":"12780b55bd9472c1","type":"decode","z":"23dbb1ee.bc2e8e","name":"decode User Protobuf","protofile":"dbab6472b07929a0","protoType":"User","x":579,"y":649,"wires":[["fc12dadf851e86f9","8da97e053ff3db75"]]},{"id":"fc12dadf851e86f9","type":"function","z":"23dbb1ee.bc2e8e","name":"Split","func":"var id = { payload: msg.payload.id };\nvar longname = { payload: msg.payload.longName};\nvar shortname = { payload: msg.payload.shortName };\nvar macaddr = { payload: msg.payload.macaddr };\nvar hw_model ={payload:msg.payload.hwModel};\nvar islicensed={payload:msg.payload.isLicensed};\n\nreturn [id,longname, shortname, macaddr, hw_model, islicensed];","outputs":6,"noerr":0,"initialize":"","finalize":"","libs":[],"x":832,"y":660,"wires":[["a4fdeb22a1cd23d6","563daaa40ddfbc2e"],["2719991c200de15d","67e736d5badbc240"],["3e74109fe6a0f6d8","b0a27c91aa642f45"],["9012d33c33db0e93"],["da11bbc24e740993","528eb77ac3fd2e5e","460fc10931356a77"],["9c0313e16deb6d70","36a22ca57723dff5"]]},{"id":"8da97e053ff3db75","type":"debug","z":"23dbb1ee.bc2e8e","name":"User decoded","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":566,"y":689,"wires":[]},{"id":"a4fdeb22a1cd23d6","type":"debug","z":"23dbb1ee.bc2e8e","name":"id","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":976.5,"y":721,"wires":[]},{"id":"2719991c200de15d","type":"debug","z":"23dbb1ee.bc2e8e","name":"long_name","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1161.5,"y":730,"wires":[]},{"id":"3e74109fe6a0f6d8","type":"debug","z":"23dbb1ee.bc2e8e","name":"short_name","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1024.5,"y":764,"wires":[]},{"id":"9012d33c33db0e93","type":"debug","z":"23dbb1ee.bc2e8e","name":"macaddr","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1202.5,"y":764,"wires":[]},{"id":"da11bbc24e740993","type":"debug","z":"23dbb1ee.bc2e8e","name":"nw_model","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1376.5,"y":730,"wires":[]},{"id":"9c0313e16deb6d70","type":"debug","z":"23dbb1ee.bc2e8e","name":"is_licensed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1391.5,"y":769,"wires":[]},{"id":"a5018a9be0780e79","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"channelId","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":786.5,"y":251,"wires":[["c6afbb9f1665b162"]]},{"id":"fda2292412d2ea1c","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"portnum","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":798.5,"y":321,"wires":[["61995c9f8e8266b3"]]},{"id":"956f09c1a5f85180","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"to","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":780.5,"y":394,"wires":[["cf066ad415df30ae"]]},{"id":"05c7099eeaac2eee","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"altitude","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1336.5,"y":433,"wires":[[]]},{"id":"1207605d22edbe7b","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"time","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1350.5,"y":472,"wires":[[]]},{"id":"563daaa40ddfbc2e","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"id","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1560.5,"y":555,"wires":[[]]},{"id":"67e736d5badbc240","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"longName","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1595.5,"y":594,"wires":[[]]},{"id":"b0a27c91aa642f45","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"shortName","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1593.5,"y":633,"wires":[[]]},{"id":"528eb77ac3fd2e5e","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"hwModel","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1597.5,"y":669,"wires":[[]]},{"id":"460fc10931356a77","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"macaddr","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1598.5,"y":706,"wires":[[]]},{"id":"36a22ca57723dff5","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"isLicensed","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1598.5,"y":746,"wires":[[]]},{"id":"eb37fb79a45684db","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"text","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":687.5,"y":447,"wires":[["553374591214eaca"]]},{"id":"8242dccd2239136b","type":"function","z":"23dbb1ee.bc2e8e","name":"toGatewayString","func":"msg.payload = \"!\" + msg.payload.toString(16);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1198.5,"y":325,"wires":[["e6fd0d68d12ab04a"]]},{"id":"202ea39d8e85aab9","type":"debug","z":"23dbb1ee.bc2e8e","name":"from as gatewayId","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1425.5,"y":366,"wires":[]},{"id":"e6fd0d68d12ab04a","type":"change","z":"23dbb1ee.bc2e8e","name":"","rules":[{"t":"set","p":"fromGateway","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1209.5,"y":366,"wires":[["202ea39d8e85aab9"]]},{"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":867.5,"y":446,"wires":[]},{"id":"a0d4288141f6a629","type":"protobuf-file","protopath":"E:\\Meshtastic-protobufs-master\\mqtt.proto","watchFile":true,"keepCase":false},{"id":"37cadac381653b1e","type":"mqtt-broker","name":"","broker":"192.168.2.45","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"dbab6472b07929a0","type":"protobuf-file","protopath":"E:\\Meshtastic-protobufs-master\\mesh.proto","watchFile":true,"keepCase":false}]