TCP Request and Ending Session

I have a nice flow using the TCP Message Node and want a clean way of ending the session. Node is set to Never - Keep Session Open.

Is there a clean way of closing the session?

Here's the flow but assumes a specific device, port number and protocol.

[{"id":"e9e83c3f.207598","type":"tab","label":"Gemini HF-1K","disabled":false,"info":""},{"id":"c23cf941.dee0e8","type":"inject","z":"e9e83c3f.207598","name":"Connect","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":120,"y":120,"wires":[["e32a3d77.c9ede8"]]},{"id":"5b470ff5.95e108","type":"function","z":"e9e83c3f.207598","name":"toString","func":"msg.payload = msg.payload.toString('utf8');\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":120,"wires":[["a9a14594.12b5a","f47a7f6d.71a09"]]},{"id":"f47a7f6d.71a09","type":"switch","z":"e9e83c3f.207598","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"password>","vt":"str"},{"t":"cont","v":"DxShop Gemini","vt":"str"},{"t":"cont","v":"BAND=","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":190,"y":320,"wires":[["accd93f0.7238d"],["7f231d55.af9ab4"],["7f231d55.af9ab4","5c4a86ea.7cd618"],["d8327909.400828"]]},{"id":"accd93f0.7238d","type":"change","z":"e9e83c3f.207598","name":"Initial Password Rsp","rules":[{"t":"set","p":"payload","pt":"msg","to":"1234","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":280,"wires":[["ac233f24.14048"]]},{"id":"9a3f1715.3a0428","type":"inject","z":"e9e83c3f.207598","name":"Standby","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"R0","payloadType":"str","x":160,"y":720,"wires":[["ad5d8467.c30088"]]},{"id":"d8327909.400828","type":"debug","z":"e9e83c3f.207598","name":"other","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":390,"y":640,"wires":[]},{"id":"a9a14594.12b5a","type":"debug","z":"e9e83c3f.207598","name":"Raw Output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":120,"wires":[]},{"id":"e32a3d77.c9ede8","type":"tcp request","z":"e9e83c3f.207598","server":"192.168.86.247","port":"9100","out":"sit","splitc":"\\n","name":"","x":450,"y":120,"wires":[["5b470ff5.95e108"]]},{"id":"a3087876.64b038","type":"link in","z":"e9e83c3f.207598","name":"","links":["ac233f24.14048","f55808e7.5934a","7c3e6a1.49d8994","ad5d8467.c30088","30fb3a8b.0d653e","51adaa1d.e458f4","9f24b7c9.c4c898","1f0fe62d.4e45ba","2bcd9c10.61b3d4","7685264b.0c60d8","31773787.955c58","81e4ebff.8b982","6f93c837.a839","b4b3530a.c585b","713fea47.f36dbc","3ea30caf.38cc14","e126aad4.e522e8","e978761f.d2684","79653330.fe430c","a2a52995.feb31","1dcdd037.dd1768","78c58f7f.4c9be8","caff488c.0262a8","39898cc0.c9894c","96390694.a205d","1accc0be.533357","f36d61c3.d63a08","88294a44.8d79c","765771b1.46302"],"x":95,"y":200,"wires":[["3ad33f19.23fc78"]]},{"id":"ac233f24.14048","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":655,"y":280,"wires":[]},{"id":"7f231d55.af9ab4","type":"change","z":"e9e83c3f.207598","name":"-> S","rules":[{"t":"set","p":"payload","pt":"msg","to":"S","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":340,"wires":[["55980eb7.bd08a"]]},{"id":"3ad33f19.23fc78","type":"template","z":"e9e83c3f.207598","name":"+ newline","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}\n","x":200,"y":200,"wires":[["e32a3d77.c9ede8"]]},{"id":"55980eb7.bd08a","type":"delay","z":"e9e83c3f.207598","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":540,"y":340,"wires":[["f55808e7.5934a"]]},{"id":"f55808e7.5934a","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":655,"y":340,"wires":[]},{"id":"ad5d8467.c30088","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":295,"y":720,"wires":[]},{"id":"3838f3e0.c26204","type":"inject","z":"e9e83c3f.207598","name":"Enable","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"R1","payloadType":"str","x":150,"y":780,"wires":[["30fb3a8b.0d653e"]]},{"id":"30fb3a8b.0d653e","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":295,"y":780,"wires":[]},{"id":"6c1d6748.2e91b","type":"inject","z":"e9e83c3f.207598","name":"Band 472kHz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B472kHz","payloadType":"str","x":470,"y":720,"wires":[["51adaa1d.e458f4"]]},{"id":"51adaa1d.e458f4","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":720,"wires":[]},{"id":"5fb2a477.f06a64","type":"inject","z":"e9e83c3f.207598","name":"Band 1.8MHz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B1.8MHz","payloadType":"str","x":470,"y":780,"wires":[["9f24b7c9.c4c898"]]},{"id":"9f24b7c9.c4c898","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":780,"wires":[]},{"id":"fb9d0e42.fa7c48","type":"inject","z":"e9e83c3f.207598","name":"Band 3.5Mhz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B3.5MHz","payloadType":"str","x":470,"y":840,"wires":[["7685264b.0c60d8"]]},{"id":"7685264b.0c60d8","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":840,"wires":[]},{"id":"ca74b690.3bb108","type":"inject","z":"e9e83c3f.207598","name":"Band 5MHz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B5MHz","payloadType":"str","x":470,"y":900,"wires":[["31773787.955c58"]]},{"id":"31773787.955c58","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":900,"wires":[]},{"id":"57edaeb8.b7b848","type":"inject","z":"e9e83c3f.207598","name":"Band 10Mhz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B10MHz","payloadType":"str","x":470,"y":1020,"wires":[["81e4ebff.8b982"]]},{"id":"81e4ebff.8b982","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":1020,"wires":[]},{"id":"f076c1c5.c3bd58","type":"inject","z":"e9e83c3f.207598","name":"Band 7MHz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B7MHz","payloadType":"str","x":470,"y":960,"wires":[["6f93c837.a839"]]},{"id":"6f93c837.a839","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":960,"wires":[]},{"id":"1d378de8.ec123a","type":"inject","z":"e9e83c3f.207598","name":"Band 18Mhz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B18MHz","payloadType":"str","x":470,"y":1140,"wires":[["b4b3530a.c585b"]]},{"id":"b4b3530a.c585b","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":1140,"wires":[]},{"id":"a20a2675.1773b","type":"inject","z":"e9e83c3f.207598","name":"Band 14MHz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B14MHz","payloadType":"str","x":470,"y":1080,"wires":[["713fea47.f36dbc"]]},{"id":"713fea47.f36dbc","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":1080,"wires":[]},{"id":"6fda2da2.1aadcc","type":"inject","z":"e9e83c3f.207598","name":"Band 24Mhz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B24MHz","payloadType":"str","x":470,"y":1260,"wires":[["3ea30caf.38cc14"]]},{"id":"3ea30caf.38cc14","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":1260,"wires":[]},{"id":"76de0025.c878e8","type":"inject","z":"e9e83c3f.207598","name":"Band 21MHz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B21MHz","payloadType":"str","x":470,"y":1200,"wires":[["e126aad4.e522e8"]]},{"id":"e126aad4.e522e8","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":1200,"wires":[]},{"id":"4f0bf81d.2452c8","type":"inject","z":"e9e83c3f.207598","name":"Band 50Mhz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B50MHz","payloadType":"str","x":470,"y":1380,"wires":[["e978761f.d2684"]]},{"id":"e978761f.d2684","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":1380,"wires":[]},{"id":"72542197.10ec98","type":"inject","z":"e9e83c3f.207598","name":"Band 28MHz","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B28MHz","payloadType":"str","x":470,"y":1320,"wires":[["79653330.fe430c"]]},{"id":"79653330.fe430c","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":595,"y":1320,"wires":[]},{"id":"b22a1a39.13ae68","type":"inject","z":"e9e83c3f.207598","name":"Antenna 1","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"A1","payloadType":"str","x":760,"y":720,"wires":[["a2a52995.feb31"]]},{"id":"a2a52995.feb31","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":895,"y":720,"wires":[]},{"id":"d22ba4c0.c885e8","type":"inject","z":"e9e83c3f.207598","name":"Antenna 2","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"A2","payloadType":"str","x":760,"y":780,"wires":[["1dcdd037.dd1768"]]},{"id":"1dcdd037.dd1768","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":895,"y":780,"wires":[]},{"id":"ab4b2896.cf4bb8","type":"inject","z":"e9e83c3f.207598","name":"Antenna 3","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"A3","payloadType":"str","x":760,"y":840,"wires":[["78c58f7f.4c9be8"]]},{"id":"78c58f7f.4c9be8","type":"link out","z":"e9e83c3f.207598","name":"","links":["a3087876.64b038"],"x":895,"y":840,"wires":[]},{"id":"849e161d.d07748","type":"debug","z":"e9e83c3f.207598","name":"Amp Stat Obj","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":580,"wires":[]},{"id":"97b682d1.ae09d","type":"function","z":"e9e83c3f.207598","name":"S2O","func":"const str2obj = str => {\n  return str\n    .split(',')\n    .map(keyVal => {\n      return keyVal\n        .split(':')\n        .map(_ => _.trim())\n    })\n    .reduce((accumulator, currentValue) => {\n      accumulator[currentValue[0]] = currentValue[1]\n      return accumulator\n    }, {})\n}\nmsg.payload = msg.payload.replace('=',':');\n\nmsg.payload = str2obj(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":530,"y":400,"wires":[["7a3f5a0.4678fa8"]]},{"id":"5c4a86ea.7cd618","type":"change","z":"e9e83c3f.207598","name":"-> / :","rules":[{"t":"change","p":"payload","pt":"msg","from":":","fromt":"str","to":"/","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"=","fromt":"str","to":":","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":400,"wires":[["97b682d1.ae09d"]]},{"id":"33f64f8e.296628","type":"comment","z":"e9e83c3f.207598","name":"Gemini HF-1K Amp ","info":"","x":110,"y":40,"wires":[]},{"id":"8ee4e48f.830e38","type":"change","z":"e9e83c3f.207598","name":"toNums","rules":[{"t":"set","p":"payload.VSWR","pt":"msg","to":"$number(msg.payload.VSWR)","tot":"jsonata"},{"t":"set","p":"payload.PWR1","pt":"msg","to":"$number(msg.payload.PWR1)","tot":"jsonata"},{"t":"set","p":"payload.PWR2","pt":"msg","to":"$number(msg.payload.PWR2)","tot":"jsonata"},{"t":"set","p":"payload.CUR1","pt":"msg","to":"$number(msg.payload.CUR1)","tot":"jsonata"},{"t":"set","p":"payload.CUR2","pt":"msg","to":"$number(msg.payload.CUR2)","tot":"jsonata"},{"t":"set","p":"payload.TMP","pt":"msg","to":"$number(msg.payload.TMP)","tot":"jsonata"},{"t":"set","p":"payload.TMPW","pt":"msg","to":"$number(msg.payload.TMPW)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":580,"wires":[["849e161d.d07748"]],"info":"# djs 02/21\nI have not put all the possible combinations of string to nums. Add more as needed."},{"id":"af6d1f62.660f58","type":"string","z":"e9e83c3f.207598","name":"PWR1","methods":[{"name":"getLeftMost","params":[{"type":"str","value":"/"}]},{"name":"delRightMost","params":[{"type":"str","value":"W"}]}],"prop":"payload.POWER","propout":"payload.PWR1","object":"msg","objectout":"msg","x":450,"y":460,"wires":[["22136ccd.49964c"]]},{"id":"22136ccd.49964c","type":"string","z":"e9e83c3f.207598","name":"PWR2","methods":[{"name":"getRightMost","params":[{"type":"str","value":"/"}]},{"name":"delRightMost","params":[{"type":"str","value":"W"}]}],"prop":"payload.POWER","propout":"payload.PWR2","object":"msg","objectout":"msg","x":590,"y":460,"wires":[["fa240487.44f928"]]},{"id":"7faa0c6c.ecd21c","type":"string","z":"e9e83c3f.207598","name":"CUR2","methods":[{"name":"getRightMost","params":[{"type":"str","value":"/"}]},{"name":"delRightMost","params":[{"type":"str","value":"A"}]}],"prop":"payload.CURRENT","propout":"payload.CUR2","object":"msg","objectout":"msg","x":890,"y":460,"wires":[["942e331c.b1aaf"]]},{"id":"fa240487.44f928","type":"string","z":"e9e83c3f.207598","name":"CUR1","methods":[{"name":"getLeftMost","params":[{"type":"str","value":"/"}]},{"name":"delRightMost","params":[{"type":"str","value":"A"}]}],"prop":"payload.CURRENT","propout":"payload.CUR1","object":"msg","objectout":"msg","x":730,"y":460,"wires":[["7faa0c6c.ecd21c"]]},{"id":"7a3f5a0.4678fa8","type":"rbe","z":"e9e83c3f.207598","name":"","func":"rbe","gap":"5","start":"","inout":"in","property":"payload","x":670,"y":400,"wires":[["af6d1f62.660f58"]]},{"id":"942e331c.b1aaf","type":"string","z":"e9e83c3f.207598","name":"TMP","methods":[{"name":"getLeftMost","params":[{"type":"str","value":"Deg"}]}],"prop":"payload.TEMERATURE","propout":"payload.TMP","object":"msg","objectout":"msg","x":450,"y":520,"wires":[["a0368802.96af88"]]},{"id":"a0368802.96af88","type":"string","z":"e9e83c3f.207598","name":"TMPU","methods":[{"name":"getRightMost","params":[{"type":"str","value":"Deg"}]},{"name":"delRightMost","params":[{"type":"str","value":"W0"}]}],"prop":"payload.TEMERATURE","propout":"payload.TMPU","object":"msg","objectout":"msg","x":590,"y":520,"wires":[["63e4a6c1.125218"]]},{"id":"63e4a6c1.125218","type":"string","z":"e9e83c3f.207598","name":"TMPW","methods":[{"name":"getRightMost","params":[{"type":"str","value":"W"}]}],"prop":"payload.TEMERATURE","propout":"payload.TMPW","object":"msg","objectout":"msg","x":730,"y":520,"wires":[["8ee4e48f.830e38"]]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.