[{"id":"be9b26ff.594728","type":"FSM","z":"106ba95c.ff91e7","name":"Traffic Lights","topic":"TRAFFIC_LIGHTS","initstate":"RED","rules":[{"n":"Red to Red+Amber","c":"CHANGE","s":"RED","d":"RED_AMBER"},{"n":"Red+Amber to Green","c":"CHANGE","s":"RED_AMBER","d":"GREEN"},{"n":"Green to Amber","c":"CHANGE","s":"GREEN","d":"AMBER"},{"n":"Amber to Red","c":"CHANGE","s":"AMBER","d":"RED"}],"x":350,"y":940,"wires":[["82bcbf25.19329","5b8f5b6a.173fa4"]]},{"id":"202f52c2.6935be","type":"inject","z":"106ba95c.ff91e7","name":"","topic":"CHANGE","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":170,"y":940,"wires":[["be9b26ff.594728"]]},{"id":"82bcbf25.19329","type":"debug","z":"106ba95c.ff91e7","name":"","active":false,"console":"false","complete":"true","x":510,"y":900,"wires":[]},{"id":"25b66579.d5d4ba","type":"delay","z":"106ba95c.ff91e7","name":"Show Green for 20s","pauseType":"delay","timeout":"20","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1000,"y":1020,"wires":[["dbdf3ad8.496cd8"]]},{"id":"dbdf3ad8.496cd8","type":"change","z":"106ba95c.ff91e7","name":"CHANGE","rules":[{"t":"set","p":"topic","pt":"msg","to":"CHANGE","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":1200,"wires":[["be9b26ff.594728"]]},{"id":"5b8f5b6a.173fa4","type":"switch","z":"106ba95c.ff91e7","name":"entry\\exit\\transition","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"_entry","vt":"str"},{"t":"cont","v":"_exit","vt":"str"},{"t":"cont","v":"_transition","vt":"str"}],"checkall":"false","outputs":3,"x":550,"y":980,"wires":[["98f3ed88.16aa5"],[],["640cd93a.dc8278","143a5c37.2c2c24","37998186.0166ae","5fb0bfbe.fb63d"]]},{"id":"98f3ed88.16aa5","type":"debug","z":"106ba95c.ff91e7","name":"","active":true,"console":"false","complete":"true","x":730,"y":900,"wires":[]},{"id":"640cd93a.dc8278","type":"switch","z":"106ba95c.ff91e7","name":"Red to Red+Amber","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Red to Red+Amber","vt":"str"}],"checkall":"true","outputs":1,"x":770,"y":980,"wires":[["c72f3452.ecb788"]]},{"id":"143a5c37.2c2c24","type":"switch","z":"106ba95c.ff91e7","name":"Red+Amber to Green","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Red+Amber to Green","vt":"str"}],"checkall":"true","outputs":1,"x":780,"y":1020,"wires":[["25b66579.d5d4ba"]]},{"id":"37998186.0166ae","type":"switch","z":"106ba95c.ff91e7","name":"Green to Amber","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Green to Amber","vt":"str"}],"checkall":"true","outputs":1,"x":760,"y":1060,"wires":[["9165befa.f926a"]]},{"id":"5fb0bfbe.fb63d","type":"switch","z":"106ba95c.ff91e7","name":"Amber to Red","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Amber to Red","vt":"str"}],"checkall":"true","outputs":1,"x":760,"y":1100,"wires":[["27b18f60.43063"]]},{"id":"27b18f60.43063","type":"delay","z":"106ba95c.ff91e7","name":"Show Red for 20s","pauseType":"delay","timeout":"20","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":990,"y":1100,"wires":[["dbdf3ad8.496cd8"]]},{"id":"9165befa.f926a","type":"delay","z":"106ba95c.ff91e7","name":"Show Amber for 3s","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":990,"y":1060,"wires":[["dbdf3ad8.496cd8"]]},{"id":"c72f3452.ecb788","type":"delay","z":"106ba95c.ff91e7","name":"Show Red+Amber for 3s","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1010,"y":980,"wires":[["dbdf3ad8.496cd8"]]},{"id":"8039d917.97c6a8","type":"comment","z":"106ba95c.ff91e7","name":"UK Traffic Light Simulator","info":"Note that under UK law, the amber light must\nbe showing for 3 seconds.\n\nSequence is:\n\n- RED\n- RED+AMBER\n- GREEN\n- AMBER\n- RED\n\nIn this finite state machine, we only need\none transition, called `CHANGE` since we only\nneed to rotate through each state in turn.\n\nIn this flow example, we use the transition\noutput to control the sequence and take the\nentry output as the actual light(s) showing.","x":190,"y":895,"wires":[]}]