Toggle (subflow)
This simple subflow toggles the two outputs. Both can be changed by double clicking the subflow.
Suitable to be used for dimming flows where a single button is used to decrease and increase brightness.
Subflow
Example flow
Copy the subflow below to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option
[{"id":"6d565a3c.17c584","type":"subflow","name":"Toggle","info":"","category":"","in":[{"x":60,"y":100,"wires":[{"id":"a6449155.3cdd8"}]}],"out":[{"x":440,"y":60,"wires":[{"id":"519f75ef.d3d8cc","port":0}]},{"x":440,"y":140,"wires":[{"id":"d35764b.91d1e98","port":0}]}],"env":[{"name":"option1","type":"bool","value":"true"},{"name":"option2","type":"bool","value":"false"}],"color":"#DDAA99","outputLabels":["Option 1","Option 2"],"icon":"node-red/switch.svg","status":{"x":440,"y":100,"wires":[{"id":"519f75ef.d3d8cc","port":0},{"id":"d35764b.91d1e98","port":0}]}},{"id":"519f75ef.d3d8cc","type":"change","z":"6d565a3c.17c584","name":"Option 1","rules":[{"t":"set","p":"payload","pt":"msg","to":"option1","tot":"env"},{"t":"set","p":"next","pt":"flow","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":80,"wires":[[]]},{"id":"d35764b.91d1e98","type":"change","z":"6d565a3c.17c584","name":"Option 2","rules":[{"t":"set","p":"payload","pt":"msg","to":"option2","tot":"env"},{"t":"set","p":"next","pt":"flow","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":120,"wires":[[]]},{"id":"a6449155.3cdd8","type":"switch","z":"6d565a3c.17c584","name":"","property":"next","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":150,"y":100,"wires":[["519f75ef.d3d8cc"],["d35764b.91d1e98"]]}]