# Start flows with by time

**URL:** https://discourse.nodered.org/t/start-flows-with-by-time/87699
**Category:** Industrial
**Created:** [4 May 2024 11:57 UTC](https://discourse.nodered.org/t/start-flows-with-by-time/87699 "2024-05-04T11:57:55Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Gravino](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Gravino](https://discourse.nodered.org/u/Gravino)
#### Post date: [4 May 2024 11:57 UTC](https://discourse.nodered.org/t/start-flows-with-by-time/87699/1 "2024-05-04T11:57:55Z")

</div>

hello i'm using node red to read data from S7 1200, i made different flows and flows node is making connection with a different PLC , i wish to start flows one at the time every 30s

---

<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: [4 May 2024 12:06 UTC](https://discourse.nodered.org/t/start-flows-with-by-time/87699/2 "2024-05-04T12:06:02Z")

</div>

Install node-red-contrib-cron-plus, Add 2 schedules, one to run at 0s, the second one to run at 30s.

Alternatively, add an inject node set to run every 30 seconds, toggle a flag in flow context, use a switch node to check the toggled value & operate your flows from there.

---

<div class="post-metadata">

### Author: ![Gravino](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Gravino](https://discourse.nodered.org/u/Gravino)
#### Post date: [4 May 2024 12:54 UTC](https://discourse.nodered.org/t/start-flows-with-by-time/87699/3 "2024-05-04T12:54:43Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dce3ac993064e65d2c569f4daf10288c8f51f5a6.png)  
i tried to use node-red-contrib-cron-plus i wish to start L1... at second 0 L2.... at second 30 L5... at second 60 L6... at second 90 L9... at second 120 but i can set schedule only from 0 to 59 ad i'm using s7 contrib that don't have a input point

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

---

<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: [4 May 2024 14:21 UTC](https://discourse.nodered.org/t/start-flows-with-by-time/87699/4 "2024-05-04T14:21:11Z")

</div>

> [@Gravino](#):
>
> i can set schedule only from 0 to 59

you can get almost any schedule you want with the right syntax.

But from your initial post I assumed there were to be 2 triggers, 1 at 0s, other at 30s. That makes the solution a little different.

Here are 2 ways:

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

```auto
[{"id":"4ddad73102ee5e1c","type":"cronplus","z":"b1993d2a213b2bb0","name":"","outputField":"payload","timeZone":"","storeName":"","commandResponseMsgOutput":"fanOut","defaultLocation":"","defaultLocationType":"default","outputs":6,"options":[{"name":"schedule1","topic":"0m:0s","payloadType":"default","payload":"","expressionType":"cron","expression":"0 0/2 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"schedule2","topic":"0m:30s","payloadType":"default","payload":"","expressionType":"cron","expression":"30 0/2 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"schedule3","topic":"1m:0s","payloadType":"default","payload":"","expressionType":"cron","expression":"0 1/2 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"schedule4","topic":"2m:30s","payloadType":"default","payload":"","expressionType":"cron","expression":"30 1/2 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":1110,"y":1500,"wires":[["aa516c65bad2342c"],["c01bf15e439b5a28"],["a19360a8cef911fb"],["27a0163ba0c425f3"],[],[]]},{"id":"aa516c65bad2342c","type":"debug","z":"b1993d2a213b2bb0","name":"debug 178","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1370,"y":1400,"wires":[]},{"id":"a9a3c667a1590c2f","type":"inject","z":"b1993d2a213b2bb0","name":"every 30s","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1120,"y":1660,"wires":[["edbc63db035ce4f8"]]},{"id":"edbc63db035ce4f8","type":"function","z":"b1993d2a213b2bb0","name":"max 4","func":"const MAX = 4\nconst messages = []\nlet index = context.get('index') || 0\nmessages[index] = msg\nindex++\nif (index >= MAX) {\n index = 0\n}\ncontext.set('index', index)\nreturn messages;","outputs":4,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1290,"y":1660,"wires":[["b3cdb653c902cfe1"],["1bd6b4ded063bc71"],["4e7a3f69a6fe02d6"],["54ec8497132787ec"]]},{"id":"c01bf15e439b5a28","type":"debug","z":"b1993d2a213b2bb0","name":"debug 179","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1370,"y":1440,"wires":[]},{"id":"a19360a8cef911fb","type":"debug","z":"b1993d2a213b2bb0","name":"debug 180","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1370,"y":1480,"wires":[]},{"id":"27a0163ba0c425f3","type":"debug","z":"b1993d2a213b2bb0","name":"debug 181","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1370,"y":1520,"wires":[]},{"id":"b3cdb653c902cfe1","type":"debug","z":"b1993d2a213b2bb0","name":"debug 182","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1490,"y":1620,"wires":[]},{"id":"1bd6b4ded063bc71","type":"debug","z":"b1993d2a213b2bb0","name":"debug 183","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1490,"y":1660,"wires":[]},{"id":"4e7a3f69a6fe02d6","type":"debug","z":"b1993d2a213b2bb0","name":"debug 184","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1490,"y":1700,"wires":[]},{"id":"54ec8497132787ec","type":"debug","z":"b1993d2a213b2bb0","name":"debug 185","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1490,"y":1740,"wires":[]}]

```

> [@Gravino](#):
>
> ad i'm using s7 contrib that don't have a input point

Not sure what you mean by that but i guess you actually want to READ the PLC at the 30s mark (on demand)?

If so, then you might need a different set of S7 nodes that permit read on demand.

---

<div class="post-metadata">

### Author: ![Gravino](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Gravino](https://discourse.nodered.org/u/Gravino)
#### Post date: [4 May 2024 14:49 UTC](https://discourse.nodered.org/t/start-flows-with-by-time/87699/5 "2024-05-04T14:49:24Z")

</div>

hi Steve i'm very grateful for the help you are giving me...yes i would like to READ the plcs on request...so in each flow i put only one plc and i was thinkingof having each flow exectude on request

---

<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: [4 May 2024 15:02 UTC](https://discourse.nodered.org/t/start-flows-with-by-time/87699/6 "2024-05-04T15:02:19Z")

</div>

If the node doesn't support an input, you cannot make it operate on demand.

There are other s7 nodes and other s7 packages that do (but it's been a few years since I used them, so cannot help further)

---

<div class="post-metadata">

### Author: ![Gravino](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Gravino](https://discourse.nodered.org/u/Gravino)
#### Post date: [4 May 2024 15:13 UTC](https://discourse.nodered.org/t/start-flows-with-by-time/87699/7 "2024-05-04T15:13:06Z")

</div>

thank you very much i think i found it ...should to be S7 control ... i'm gonna test now i will give a feedback

---

<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: [3 July 2024 15:13 UTC](https://discourse.nodered.org/t/start-flows-with-by-time/87699/8 "2024-07-03T15:13:27Z")

</div>

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