# Two injects - don't want at the same time

**URL:** <https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135>\
**Category:** General\
**Created:** [11 February 2022 08:46 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135 "2022-02-11T08:46:43Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![alda](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@alda](https://discourse.nodered.org/u/alda)\
**Post date:** [11 February 2022 08:46 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/1 "2022-02-11T08:46:43Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/c/9c8b11a02c8b4f97b92676002a386f76c0de5ec6.png)  
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

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [11 February 2022 08:58 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/2 "2022-02-11T08:58:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [11 February 2022 09:00 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/3 "2022-02-11T09:00:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alda](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@alda](https://discourse.nodered.org/u/alda)\
**Post date:** [11 February 2022 09:02 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/4 "2022-02-11T09:02:25Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/4/b4f084ff5f0701d1b8002f04ecd094082455e041.jpeg)

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [11 February 2022 09:09 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/5 "2022-02-11T09:09:35Z")

</div>

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.

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

**Author:** ![alda](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@alda](https://discourse.nodered.org/u/alda)\
**Post date:** [11 February 2022 09:12 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/6 "2022-02-11T09:12:36Z")

</div>

Thank you  
Problem is , that now is sending all as first message  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/6/a616f66a8d945d1a051b776c4af4e842339bb736.jpeg)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/a/6a2860bf4b1bb547d5c06b9edd9b3ff78daa1972.png)

---

<div class="post-metadata">

**Author:** ![alda](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@alda](https://discourse.nodered.org/u/alda)\
**Post date:** [11 February 2022 09:45 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/7 "2022-02-11T09:45:08Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/3/a37782942db3520aa54b1147862b7df1ac16d78c.png)

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [11 February 2022 10:12 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/8 "2022-02-11T10:12:48Z")

</div>

second command should go out of second port.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0b2556c66b51a11282945702d9cca6f7c61580af.png)

![2out](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/4/b42dc3fbfd94beb15a122d3d12abd91ad9eb50e6.gif)

---

<div class="post-metadata">

**Author:** ![alda](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@alda](https://discourse.nodered.org/u/alda)\
**Post date:** [11 February 2022 10:22 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/9 "2022-02-11T10:22:30Z")

</div>

I don't have this option

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [11 February 2022 10:25 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/10 "2022-02-11T10:25:34Z")

</div>

what is your node-red version ?

---

<div class="post-metadata">

**Author:** ![alda](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@alda](https://discourse.nodered.org/u/alda)\
**Post date:** [11 February 2022 10:26 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/11 "2022-02-11T10:26:22Z")

</div>

version v1.0.3

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [11 February 2022 10:28 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/12 "2022-02-11T10:28:11Z")

</div>

may be not in that version,

try this then

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

**Author:** ![alda](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@alda](https://discourse.nodered.org/u/alda)\
**Post date:** [11 February 2022 14:15 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/13 "2022-02-11T14:15:06Z")

</div>

This solution is working well. Thank you

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [25 February 2022 14:16 UTC](https://discourse.nodered.org/t/two-injects-dont-want-at-the-same-time/58135/14 "2022-02-25T14:16:02Z")

</div>

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