# Sequence with variable delays

**URL:** <https://discourse.nodered.org/t/sequence-with-variable-delays/47052>\
**Category:** General\
**Created:** [11 June 2021 19:37 UTC](https://discourse.nodered.org/t/sequence-with-variable-delays/47052 "2021-06-11T19:37:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsew20](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@dsew20](https://discourse.nodered.org/u/dsew20)\
**Post date:** [11 June 2021 19:37 UTC](https://discourse.nodered.org/t/sequence-with-variable-delays/47052/1 "2021-06-11T19:37:53Z")

</div>

Hello,

I am new to node-red, but finding it to be awesome. I am trying to create a sequence of messages to automate some irrigation. So, looking to create a sequence of outputs with different periods, such as

Output Zone 1 - wait 10 mins  
Output Zone 2 - wait 10 mins  
Output Zone 3 - wait 20 mins  
Output Zone 4 - wait 20 mins  
Output Zone 5 - wait 30 mins  
Output off

I have got most of this tried using a functions and can get the sequence working and have tried the delay node (set to rate limiter) which works great with a common delay.

But, any ideas on how to create a sequence with different wait periods?

DS

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [11 June 2021 19:48 UTC](https://discourse.nodered.org/t/sequence-with-variable-delays/47052/2 "2021-06-11T19:48:55Z")

</div>

Pretty simple to achieve with 5 schedules in the node-red-contrib-cron-plus node.

---

<div class="post-metadata">

**Author:** ![dsew20](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@dsew20](https://discourse.nodered.org/u/dsew20)\
**Post date:** [11 June 2021 21:17 UTC](https://discourse.nodered.org/t/sequence-with-variable-delays/47052/3 "2021-06-11T21:17:38Z")

</div>

I like that idea. Simple.

But, with CRON do you not need to specify a time / date / etc? Rather than a duration?

I would like to trigger the sequence when a message is received, and then follow the sequence / timing: 1 for 10mins; 2 for 10mins; 3 for 20 mins; etc

Can the cronplus node be triggered and only then start a sequence for defined intervals?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [11 June 2021 22:57 UTC](https://discourse.nodered.org/t/sequence-with-variable-delays/47052/4 "2021-06-11T22:57:12Z")

</div>

You could just have a cascade of delay nodes...

---

<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 June 2021 23:42 UTC](https://discourse.nodered.org/t/sequence-with-variable-delays/47052/5 "2021-06-11T23:42:33Z")

</div>

If you are doing a irrigation/sprinkler there are probably lots of people in here who have done it. Maybe ask for examples?

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [12 June 2021 08:52 UTC](https://discourse.nodered.org/t/sequence-with-variable-delays/47052/6 "2021-06-12T08:52:31Z")

</div>

I did a similar thing with variable delays between transitions in a finite state machine FSM).

> [@Need help to use if function in Node Red](https://discourse.nodered.org/t/need-help-to-use-if-function-in-node-red/36091/12):
>
> Just had a few spare minutes to take a look at having different delays between transitions. [{"id":"743e732.c12228c","type":"function","z":"be3ab1ef.3f0a68","name":"Decode RED light","func":"var fsm\_state = flow.get(\"state\_counter\");\n\nif (fsm\_state === 0 || fsm\_state == 1)\n {msg.payload = 1;\n node.status({fill:\"red\",shape:\"dot\",text:\"Red ON\"});\n }\n \nelse\n {msg.payload = 0;\n node.status({});\n }\n\nreturn msg;","outputs":1,"no…

---

<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:** [11 August 2021 08:53 UTC](https://discourse.nodered.org/t/sequence-with-variable-delays/47052/7 "2021-08-11T08:53:23Z")

</div>

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