Skip to content

Instantly share code, notes, and snippets.

@mikebiddell
Created June 12, 2015 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikebiddell/2f613353361f35ddb03d to your computer and use it in GitHub Desktop.
Save mikebiddell/2f613353361f35ddb03d to your computer and use it in GitHub Desktop.
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":[]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment