JOIN two strings into one string

Hi, Iam trying to send url command to differnet ip. Command is always the same but IP differs. I have about 45 IP. So i dont want to have 45 injects to set ON and 45 to set OFF. My idea was "a list of IP" + command = sends a result.
I tried with manual JOIN node and string, but the order of messages isnt always right. msg.parts.id isnt working (but i assume i understand it wrong). Does anyone has an idea how to make it?

Hi,

maybe you can create an array of your IPs and loop throught them in a Function node ?
possibly also use a Delay node to Rate limit the commands if you have to.

Not sure if its what you are looking for but here's an example :

[{"id":"87b9c2b4.326cb","type":"inject","z":"794b81b0.83a06","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":380,"wires":[["49470cbb.c05dd4"]]},{"id":"49470cbb.c05dd4","type":"function","z":"794b81b0.83a06","name":"","func":"let ips = [\n'192.68.1.0',\n'192.68.1.1',\n'192.68.1.2',\n'192.68.1.3',\n'192.68.1.4',\n'192.68.1.5',\n'192.68.1.6',\n'192.68.1.7',\n'192.68.1.8',\n'192.68.1.9',\n'192.68.1.10',\n'192.68.1.11',\n'192.68.1.12',\n'192.68.1.13',\n'192.68.1.14',\n'192.68.1.15']\n\nips.forEach( ip => {\n    \n    node.send({payload: `Command to ${ip}`})\n    \n})\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":380,"wires":[["b9de523a.0b57d"]]},{"id":"c9849f5e.a65238","type":"debug","z":"794b81b0.83a06","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":380,"wires":[]},{"id":"b9de523a.0b57d","type":"delay","z":"794b81b0.83a06","name":"","pauseType":"rate","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":700,"y":380,"wires":[["c9849f5e.a65238"]]}]

What is/platforms are they on ? Linux has a command dsh ( for distributed shel) that provides exactly that capability.

1 Like

works great, thats what i wanted

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