Reference Topic:
Exec command using function node in NodeRED - General - Node-RED Forum
This topic is not getting response so i have to create a new one and i have a issue mentioned in that topic which says that join node is giving me unwanted data due to After a number of message parts set to 24 this leads to a problem. So, I am explaining you my issue again i have 3 RTD HAT which have 8 ports each for temp sensors, so when i connect 3 RTD HAT i get 24 temp Sensors from this code which is given by @jbudd it works well till this.
[{"id":"246b29e8a1e83da8","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"d5ae235057454821","type":"group","z":"246b29e8a1e83da8","name":"24 Discrete Commands - No Need For Split!","style":{"label":true},"nodes":["f7c49f5d17e518bf","9207bd218eacab96","c7ca2dbd434c8ea8","69ec1362b364ab2c","02609ea7b4a2ab06","40688440afc0037c","3ce268ef3a5ec6fb","73750f83d4e0afd5","65717d848a8a7eaf"],"x":34,"y":219,"w":952,"h":162},{"id":"0781401244ccfb7c","type":"group","z":"246b29e8a1e83da8","name":"One Very Long Command With &&. ","style":{"label":true},"nodes":["af25b8098c19c102","eff4574f0d6fb3b2","81d51c83bee6e104","86e3d79acaf2f4a3","95314a9b07d2c18a","07450de398d37621","abd0ed563e6e6fb7","b593b241aa9651f1","73b8a1762ff0f7b2"],"x":34,"y":39,"w":952,"h":149.5},{"id":"b593b241aa9651f1","type":"comment","z":"246b29e8a1e83da8","g":"0781401244ccfb7c","name":"One very long command","info":"","x":190,"y":80,"wires":[]},{"id":"af25b8098c19c102","type":"function","z":"246b29e8a1e83da8","g":"0781401244ccfb7c","name":"One command with &&","func":"var cmd = 'rtd 0 read 1';\nvar cmd1 = 'rtd 0 read 2';\nvar cmd2 = 'rtd 0 read 3';\nvar cmd3 = 'rtd 0 read 4';\nvar cmd4 = 'rtd 0 read 5';\nvar cmd5 = 'rtd 0 read 6';\nvar cmd6 = 'rtd 0 read 7';\nvar cmd7 = 'rtd 0 read 8';\nvar cmd8 = 'rtd 1 read 1';\nvar cmd9 = 'rtd 1 read 2';\nvar cmd10 = 'rtd 1 read 3';\nvar cmd11 = 'rtd 1 read 4';\nvar cmd12 = 'rtd 1 read 5';\nvar cmd13 = 'rtd 1 read 6';\nvar cmd14 = 'rtd 1 read 7';\nvar cmd15 = 'rtd 1 read 8';\nvar cmd16 = 'rtd 2 read 1';\nvar cmd17 = 'rtd 2 read 2';\nvar cmd18 = 'rtd 2 read 3';\nvar cmd19 = 'rtd 2 read 4';\nvar cmd20 = 'rtd 2 read 5';\nvar cmd21 = 'rtd 2 read 6';\nvar cmd22 = 'rtd 2 read 7';\nvar cmd23 = 'rtd 2 read 8';\n\nmsg.payload = cmd + '&&' + cmd1 + '&&' + cmd2 + '&&' + cmd3 + '&&' + cmd4 + '&&' + cmd5 + '&&' + cmd6 + '&&' + cmd7 + '&&' + cmd8 + '&&' + cmd9 + '&&' + cmd10 + '&&' + cmd11 + '&&' + cmd12 + '&&' + cmd13 + '&&' + cmd14 + '&&' + cmd15 + '&&' + cmd16 + '&&' + cmd17 + '&&' + cmd18 + '&&' + cmd19 + '&&' + cmd20 + '&&' + cmd21 + '&&' + cmd22 + '&&' + cmd23\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":140,"wires":[["86e3d79acaf2f4a3"]]},{"id":"eff4574f0d6fb3b2","type":"inject","z":"246b29e8a1e83da8","g":"0781401244ccfb7c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":140,"wires":[["af25b8098c19c102"]]},{"id":"81d51c83bee6e104","type":"debug","z":"246b29e8a1e83da8","g":"0781401244ccfb7c","name":"debug 230","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":80,"wires":[]},{"id":"86e3d79acaf2f4a3","type":"exec","z":"246b29e8a1e83da8","g":"0781401244ccfb7c","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":650,"y":140,"wires":[["abd0ed563e6e6fb7"],["73b8a1762ff0f7b2"],[]]},{"id":"95314a9b07d2c18a","type":"split","z":"246b29e8a1e83da8","g":"0781401244ccfb7c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":610,"y":80,"wires":[["07450de398d37621"]]},{"id":"07450de398d37621","type":"join","z":"246b29e8a1e83da8","g":"0781401244ccfb7c","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"24","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":730,"y":80,"wires":[["81d51c83bee6e104"]]},{"id":"f7c49f5d17e518bf","type":"function","z":"246b29e8a1e83da8","g":"d5ae235057454821","name":"24 discrete commands","func":"for (let rtd = 0; rtd < 3; rtd++) {\n for (let read = 1; read < 9; read++) {\n node.send({ payload: `rtd ${rtd} read ${read}` })\n }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":320,"wires":[["40688440afc0037c"]]},{"id":"9207bd218eacab96","type":"inject","z":"246b29e8a1e83da8","g":"d5ae235057454821","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":320,"wires":[["f7c49f5d17e518bf"]]},{"id":"c7ca2dbd434c8ea8","type":"debug","z":"246b29e8a1e83da8","g":"d5ae235057454821","name":"debug 231","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":260,"wires":[]},{"id":"69ec1362b364ab2c","type":"exec","z":"246b29e8a1e83da8","g":"d5ae235057454821","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":650,"y":320,"wires":[["3ce268ef3a5ec6fb"],["65717d848a8a7eaf"],[]]},{"id":"02609ea7b4a2ab06","type":"join","z":"246b29e8a1e83da8","g":"d5ae235057454821","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"24","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":730,"y":260,"wires":[["c7ca2dbd434c8ea8"]]},{"id":"abd0ed563e6e6fb7","type":"function","z":"246b29e8a1e83da8","g":"0781401244ccfb7c","name":"Remove new lines from response","func":"msg.payload = msg.payload.trim()\nif (msg.payload)\n return msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":80,"wires":[["95314a9b07d2c18a"]]},{"id":"40688440afc0037c","type":"delay","z":"246b29e8a1e83da8","g":"d5ae235057454821","name":"Rate limit","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"4","nbRateUnits":"0.1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":520,"y":320,"wires":[["69ec1362b364ab2c"]]},{"id":"3ce268ef3a5ec6fb","type":"function","z":"246b29e8a1e83da8","g":"d5ae235057454821","name":"Remove new lines from responses","func":"msg.payload = msg.payload.trim()\nif (msg.payload)\n return msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":260,"wires":[["02609ea7b4a2ab06"]]},{"id":"73750f83d4e0afd5","type":"comment","z":"246b29e8a1e83da8","g":"d5ae235057454821","name":"Rate Limit may not be needed","info":"","x":840,"y":340,"wires":[]},{"id":"73b8a1762ff0f7b2","type":"debug","z":"246b29e8a1e83da8","g":"0781401244ccfb7c","name":"Errors?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":140,"wires":[]},{"id":"65717d848a8a7eaf","type":"debug","z":"246b29e8a1e83da8","g":"d5ae235057454821","name":"Errors?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":300,"wires":[]}]
but when i remove 1 RTD HAT and it get from 24 to 16 then it gives me some wrong information which is not valid because the join node sends message 24 i have to manual change every time if i remove the RTD HAT which is not a solution in this. is there any other solution to join msg without join node.