Flow

Flow:

  • On
  • Off
[{"id":"f2a57185.7d4d38","type":"inject","z":"21c52910.4ca56e","name":"ON","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":110,"y":80,"wires":[["58ebe09e.68959"]]},{"id":"9b1f3cdb.63aef8","type":"inject","z":"21c52910.4ca56e","name":"OFF","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":110,"y":120,"wires":[["58ebe09e.68959"]]},{"id":"afe31c2e.19227","type":"switch","z":"21c52910.4ca56e","name":"Is this flow enabled?","property":"start-stop","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":340,"y":200,"wires":[["4bb6caa6.9ee14c"]]},{"id":"ee6a7083.313a08","type":"inject","z":"21c52910.4ca56e","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"x":130,"y":200,"wires":[["afe31c2e.19227","42b522a3.ed6b74"]]},{"id":"4bb6caa6.9ee14c","type":"function","z":"21c52910.4ca56e","name":"Generate Random Data","func":"msg.payload = Math.round(Math.random()*100);\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":200,"wires":[["9b9a4783.79fdd"]]},{"id":"9b9a4783.79fdd","type":"debug","z":"21c52910.4ca56e","name":"","active":true,"console":"false","complete":"false","x":810,"y":200,"wires":[]},{"id":"ec32d77d.694f5","type":"debug","z":"21c52910.4ca56e","name":"","active":true,"console":"false","complete":"false","x":530,"y":100,"wires":[]},{"id":"42b522a3.ed6b74","type":"function","z":"21c52910.4ca56e","name":"","func":"var enabled = flow.get('start-stop')||false;\nmsg.payload = enabled;\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":280,"wires":[["646c1496.fbacf4"]]},{"id":"646c1496.fbacf4","type":"debug","z":"21c52910.4ca56e","name":"","active":false,"console":"false","complete":"false","x":450,"y":280,"wires":[]},{"id":"58ebe09e.68959","type":"change","z":"21c52910.4ca56e","name":"Enable / Disable this flow","rules":[{"t":"set","p":"start-stop","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":100,"wires":[["ec32d77d.694f5"]]}]
miiGit

Flow Info

created 3 months, 2 weeks ago

Node Types

Core
  • change (x1)
  • debug (x3)
  • function (x2)
  • inject (x3)
  • switch (x1)

Tags

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