Two injects - don't want at the same time

Hello,
I'm new to node red and I want ask. I have two TCP injects :


Because both are to the same ip adress, I need to be sure that injects will go in the sequence, not at the same time. How can I do it ?
Thanks Alex

Without fully understanding your specific needs two ways come to mind. One would be one inject node that feeds into your flow at two points. One route would input into a delay node set to whatever delay you need. The other way would use two cron plus nodes set to two different times. I'm sure there might be other ways as well but these two come to my mind.

what is the frequency of repeat ? how much delay are you expecting between two ?

I want sent one inject, wait aprox 5seconds and then second one. Next sequence after 5minutes.
With first request I'm reading from main unit requested temperature for 16devices and with second request I'm reading real values of this 16devices. For each request is reply different, so I'm using 2buffer parsers to get what I need from each answer.

you can use regular inject node with an interval of 5 minutes, then add a delay or trigger node with 2 outputs, one immediately and next with a 5 seconds delay.

[{"id":"88d8b48d2aacda08","type":"inject","z":"5864c70bb4917501","name":"Trigger on start and then every 5 minutes","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":620,"wires":[["5632eef9898eb667"]]},{"id":"5632eef9898eb667","type":"trigger","z":"5864c70bb4917501","name":"","op1":"First command","op2":"Second Command","op1type":"str","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":520,"y":620,"wires":[["0fecc8a8f706a2f3"],["e51460d9debe4d67"]],"outputLabels":["First","Second"]},{"id":"0fecc8a8f706a2f3","type":"debug","z":"5864c70bb4917501","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":560,"wires":[]},{"id":"e51460d9debe4d67","type":"debug","z":"5864c70bb4917501","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":660,"wires":[]}]

Thank you
Problem is , that now is sending all as first message
image

not working, bot are going into first node
I want send two different buffers, but problem is, that second output is away

second command should go out of second port.

2out

I don't have this option

what is your node-red version ?

version v1.0.3

may be not in that version,

try this then

[{"id":"29e1c84515e0cf67","type":"inject","z":"5864c70bb4917501","name":"Trigger on start and then every 5 minutes","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":700,"wires":[["ccaeb3025906472f","53916e58b8f56eb4"]]},{"id":"ccaeb3025906472f","type":"change","z":"5864c70bb4917501","name":"FIrst Command","rules":[{"t":"set","p":"payload","pt":"msg","to":"First","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":680,"wires":[["9a113e536af8d52d"]]},{"id":"53916e58b8f56eb4","type":"delay","z":"5864c70bb4917501","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":440,"y":740,"wires":[["30f62b4439f62a09"]]},{"id":"9a113e536af8d52d","type":"debug","z":"5864c70bb4917501","name":"First","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":790,"y":660,"wires":[]},{"id":"30f62b4439f62a09","type":"change","z":"5864c70bb4917501","name":"Second Command","rules":[{"t":"set","p":"payload","pt":"msg","to":"Second","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":740,"wires":[["8ed597b7fce61fd6"]]},{"id":"8ed597b7fce61fd6","type":"debug","z":"5864c70bb4917501","name":"Second","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":820,"y":740,"wires":[]}]
1 Like

This solution is working well. Thank you

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