Start flows with by time

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

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.


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

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

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

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.

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

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)

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

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