Function node, how to send text out 5 times to debug node?

Oh, I have been spreading fake news all these years. How on earth did I miss that change?

However, that text is somewhat confusing (I think). When it refers to the first message I think it does not mean in the situation that we have here, with a sequence of send(msg) statements. It relates to the condition where one node.send() is used to send a sequence of messages. Something like
node.send([[msg,msg,msg]])
so in NR before 1.0 that would not clone the first msg but would clone the rest. Now it will clone all of them unless false is passed, in which case it will not clone the first one. In the case of send with only one message being sent (or a sequence of sends each with only one message) then the boolean parameter tells it whether or not to clone that message.

Looking at this I realise that that @questuk's requirement can be satisfied with a Function node containing just

if (msg.payload >= 80)
{
   msg.payload = "Humidity exceeded ... in the ,,, LOFT ... Module ,, Twenty Five ... "
   node.send([[msg,msg,msg,msg,msg]]); // send multiple clones of the message
}

In case anyone wants to confirm how the cloning works then here is a simple flow demonstrating various conditions

[{"id":"fddda6a178227ed1","type":"inject","z":"bdd7be38.d3b55","name":"Default","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":250,"y":5780,"wires":[["f11d19c6af0ca7bf"]]},{"id":"f11d19c6af0ca7bf","type":"function","z":"bdd7be38.d3b55","name":"send(msg)","func":"msg.payload = 1\nnode.send(msg)\nmsg.payload++\nnode.send(msg)\nmsg.payload++\nnode.send(msg)\nreturn null","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":5780,"wires":[["940c6dc5e6e48f31"]]},{"id":"940c6dc5e6e48f31","type":"debug","z":"bdd7be38.d3b55","name":"debug 2499","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":950,"y":5860,"wires":[]},{"id":"addff4c239639ec6","type":"inject","z":"bdd7be38.d3b55","name":"no clone","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":260,"y":5840,"wires":[["c62dd3b69d46dd01"]]},{"id":"c62dd3b69d46dd01","type":"function","z":"bdd7be38.d3b55","name":"send(msg, false)","func":"msg.payload = 1\nnode.send(msg,false)\nmsg.payload++\nnode.send(msg, false)\nmsg.payload++\nnode.send(msg, false)\nreturn null","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":5840,"wires":[["940c6dc5e6e48f31"]]},{"id":"4be8e9aaed4afea9","type":"inject","z":"bdd7be38.d3b55","name":"Default multi","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":270,"y":5900,"wires":[["92c9cdcc7e7f1b5f"]]},{"id":"92c9cdcc7e7f1b5f","type":"function","z":"bdd7be38.d3b55","name":"send([[msg,msg,msg]])","func":"msg.payload = 1\nnode.send([[msg,msg,msg]])\nmsg.payload = \"oops\"\nreturn null","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":5900,"wires":[["940c6dc5e6e48f31"]]},{"id":"bc7191e041772909","type":"inject","z":"bdd7be38.d3b55","name":"Default multi false","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":290,"y":5960,"wires":[["96f48d649aeba089"]]},{"id":"96f48d649aeba089","type":"function","z":"bdd7be38.d3b55","name":"send([[msg,msg,msg]], false)","func":"msg.payload = 1\nnode.send([[msg,msg,msg]], false)\nmsg.payload = \"oops\"\nreturn null","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":5960,"wires":[["940c6dc5e6e48f31"]]},{"id":"88e2b935ceb06e23","type":"inject","z":"bdd7be38.d3b55","name":"Default multi false preceeded by default","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":350,"y":6020,"wires":[["21e2da34e3439ac7"]]},{"id":"21e2da34e3439ac7","type":"function","z":"bdd7be38.d3b55","name":"send(msg); send([[msg,msg,msg]], false)","func":"msg.payload = 1\nnode.send(msg)\nnode.send([[msg,msg,msg]], false)\nmsg.payload = \"oops\"\nreturn null","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":6020,"wires":[["940c6dc5e6e48f31"]]}]

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