Experimental flow to illustrate turning flows on and off using globals

The stop flow function is controlled by the global flag 'keepgoing'.

'keepgoing' can be set TRUE/FALSE to inhibit or allow the flow. Setting of TRUE or FALSE can be achieved using inject and time between, to inhibit flows at set times of the day..... all based on an idea by Julian Knight !!!!

[{"id":"7a0012e1.85ffec","type":"inject","name":"","topic":"PT2262","payload":"sheena on","payloadType":"string","repeat":"","crontab":"*/1 0-18 * * *","once":false,"x":203,"y":338,"z":"c3aed0d3.3ce58","wires":[["74794f5c.8b86b"]]},{"id":"74794f5c.8b86b","type":"function","name":"stop flow","func":"if ( context.global.keepgoing == true ) {\n  return msg;\n} else {\n  return;\n}\n","outputs":1,"valid":true,"x":385,"y":342,"z":"c3aed0d3.3ce58","wires":[["438e5762.bc71a8"]]},{"id":"438e5762.bc71a8","type":"debug","name":"","active":true,"console":"false","complete":"true","x":556,"y":339,"z":"c3aed0d3.3ce58","wires":[]},{"id":"fb0f23f6.04f0e","type":"inject","name":"","topic":"PT2262","payload":"sheena on","payloadType":"string","repeat":"","crontab":"","once":false,"x":186,"y":394,"z":"c3aed0d3.3ce58","wires":[["d075131.f2f8af"]]},{"id":"d075131.f2f8af","type":"function","name":"flow on","func":"context.global.keepgoing = true ;\n  return msg;\n","outputs":1,"valid":true,"x":365,"y":397,"z":"c3aed0d3.3ce58","wires":[["c814f162.37eb1"]]},{"id":"c814f162.37eb1","type":"debug","name":"","active":true,"console":"false","complete":"true","x":562,"y":390,"z":"c3aed0d3.3ce58","wires":[]},{"id":"742d4efe.8bd2b","type":"inject","name":"","topic":"PT2262","payload":"sheena on","payloadType":"string","repeat":"","crontab":"","once":false,"x":186,"y":447,"z":"c3aed0d3.3ce58","wires":[["7061ce58.8f9e3"]]},{"id":"7061ce58.8f9e3","type":"function","name":"flow off","func":"context.global.keepgoing = false ;\n  return msg;\n","outputs":1,"valid":true,"x":351,"y":451,"z":"c3aed0d3.3ce58","wires":[["efa44ea7.105bb"]]},{"id":"efa44ea7.105bb","type":"debug","name":"","active":true,"console":"false","complete":"true","x":589,"y":437,"z":"c3aed0d3.3ce58","wires":[]}]

Flow Info

Created 9 years, 7 months ago
Updated 9 years, 4 months ago
Rating: 1 1

Owner

Actions

Rate:

Node Types

Core
  • debug (x3)
  • function (x3)
  • inject (x3)

Tags

  • Inhibit
  • flow
  • time
  • between
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option