After some feedback from other forum members, I am attempting to re-develop a flow that controls a multi-channel device. As I was working through this it seems that having a subflow within a subflow will be required. Is this frowned upon? So far my example works as expected. I have noticed though that once there are nested subflows, debug messages cease to function within the main and nested subflow for some reason. This is not a huge problem, just an observation. Here is my example flow. Any feedback is greatly appreciated. Thanks!
[{"id":"92d4aa52.741878","type":"subflow","name":"ch_control","info":"","category":"","in":[{"x":64.00000095367432,"y":258.99999809265137,"wires":[{"id":"761558c9.42f968"},{"id":"b0a3e96.aa53018"}]}],"out":[{"x":989.9999980926514,"y":259.99999809265137,"wires":[{"id":"bbe9306a.eae48","port":0},{"id":"ce85646f.bca3d8","port":0}]}],"env":[]},{"id":"a9a0e6cc.9f3828","type":"function","z":"92d4aa52.741878","name":"doubleVal","func":"temp = msg.payload\ntemp = temp*2\nflow.set(\"chXTemperature\", temp)\nreturn msg;","outputs":1,"noerr":0,"x":411.8333225250244,"y":252.99611949920654,"wires":[["bbe9306a.eae48"]]},{"id":"bbe9306a.eae48","type":"function","z":"92d4aa52.741878","name":"set topic","func":"channel = flow.get(\"chNum\")\nmsg.payload = flow.get(\"chXTemperature\")\ntemperature = msg.payload\nmsg.topic = channel + \"/temperature\"\nreturn msg;","outputs":1,"noerr":0,"x":723.8332061767578,"y":237.9961452484131,"wires":[[]]},{"id":"761558c9.42f968","type":"switch","z":"92d4aa52.741878","name":"","property":"param","propertyType":"msg","rules":[{"t":"eq","v":"temperature","vt":"str"},{"t":"eq","v":"power","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":200,"y":259.6627712249756,"wires":[["a9a0e6cc.9f3828"],["8f55d485.c45fa8"]]},{"id":"8f55d485.c45fa8","type":"function","z":"92d4aa52.741878","name":"doubleVal","func":"power = msg.payload\npower = power*2\nflow.set(\"chXPower\", power)\nreturn msg;","outputs":1,"noerr":0,"x":412.8528480529785,"y":305,"wires":[["ce85646f.bca3d8"]]},{"id":"ce85646f.bca3d8","type":"function","z":"92d4aa52.741878","name":"set topic","func":"channel = flow.get(\"chNum\")\nmsg.payload = flow.get(\"chXPower\")\npower = msg.payload\nmsg.topic = channel + \"/power\"\nreturn msg;","outputs":1,"noerr":0,"x":733.8527774810791,"y":304.0000410079956,"wires":[[]]},{"id":"b0a3e96.aa53018","type":"function","z":"92d4aa52.741878","name":"get channel number","func":"msg = msg\nparam = msg.topic\nparam_arr = param.split(\"/\")\nmsg.param = param_arr[1]\nflow.set(\"chNum\", msg.param)\nreturn msg;","outputs":1,"noerr":0,"x":242.85284423828125,"y":165.99999809265137,"wires":[[]]},{"id":"e89e1a81.ab1328","type":"subflow","name":"route_channels","info":"","category":"","in":[],"out":[{"x":1234.0001029968262,"y":248.0000877380371,"wires":[{"id":"7a1cdecd.db12c","port":0},{"id":"82e3255e.ef4508","port":0},{"id":"2652d3be.34560c","port":0},{"id":"be5e9236.200e7","port":0}]}],"env":[]},{"id":"dddc8a30.c98788","type":"mqtt in","z":"e89e1a81.ab1328","name":"","topic":"channels/#","qos":"2","datatype":"auto","broker":"a86bbd8c.6015c","x":221.0195140838623,"y":243.00389671325684,"wires":[["a1a93b04.007188","57c6f97a.e64b58"]]},{"id":"fda4ac56.e742a","type":"switch","z":"e89e1a81.ab1328","name":"ch switch","property":"channel","propertyType":"msg","rules":[{"t":"eq","v":"ch1","vt":"str"},{"t":"eq","v":"ch2","vt":"str"},{"t":"eq","v":"ch3","vt":"str"},{"t":"eq","v":"ch4","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":620.0195121765137,"y":241.00391101837158,"wires":[["7a1cdecd.db12c"],["82e3255e.ef4508"],["2652d3be.34560c"],["be5e9236.200e7"]]},{"id":"a1a93b04.007188","type":"function","z":"e89e1a81.ab1328","name":"get entry param","func":"msg = msg\nparam = msg.topic\nparam_arr = param.split(\"/\")\nmsg.param = param_arr[2]\nmsg.channel = param_arr[1]\nreturn msg;","outputs":1,"noerr":0,"x":414.87232398986816,"y":241.6744508743286,"wires":[["fda4ac56.e742a","4b70be2f.ae9de"]]},{"id":"4b70be2f.ae9de","type":"debug","z":"e89e1a81.ab1328","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":531.7434101104736,"y":364.17062759399414,"wires":[]},{"id":"57c6f97a.e64b58","type":"debug","z":"e89e1a81.ab1328","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":341.73558235168457,"y":389.17834854125977,"wires":[]},{"id":"7a1cdecd.db12c","type":"subflow:92d4aa52.741878","z":"e89e1a81.ab1328","name":"ch1","env":[],"x":891.8828868865967,"y":202.85544967651367,"wires":[[]]},{"id":"82e3255e.ef4508","type":"subflow:92d4aa52.741878","z":"e89e1a81.ab1328","name":"ch2","env":[],"x":893.0195140838623,"y":250.00389671325684,"wires":[[]]},{"id":"2652d3be.34560c","type":"subflow:92d4aa52.741878","z":"e89e1a81.ab1328","name":"ch3","env":[],"x":892.0195140838623,"y":310.00389671325684,"wires":[[]]},{"id":"be5e9236.200e7","type":"subflow:92d4aa52.741878","z":"e89e1a81.ab1328","name":"ch4","env":[],"x":887.017333984375,"y":366.0104064941406,"wires":[[]]},{"id":"32365555.427b8a","type":"tab","label":"nested subflow","disabled":false,"info":""},{"id":"43652d83.ab56e4","type":"mqtt out","z":"32365555.427b8a","name":"","topic":"","qos":"2","retain":"true","broker":"a86bbd8c.6015c","x":593.017333984375,"y":362.99827671051025,"wires":[]},{"id":"9798da6e.37b368","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":3,"width":0,"height":0,"name":"","label":"ch1 2x temperature","format":"{{msg.payload}}","layout":"row-spread","x":1241.0175743103027,"y":242.66489791870117,"wires":[]},{"id":"3ced53d0.e4af6c","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":5,"width":0,"height":0,"name":"","label":"ch2 2x temperature","format":"{{msg.payload}}","layout":"row-spread","x":1271.8506126403809,"y":351.9982023239136,"wires":[]},{"id":"b7095c39.41f7","type":"ui_text_input","z":"32365555.427b8a","name":"","label":"ch1 Temperature","tooltip":"","group":"ed9afc55.3641c","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"channels/ch1/temperature","x":352.0172233581543,"y":287.66493701934814,"wires":[["43652d83.ab56e4"]]},{"id":"9e7b222b.a0551","type":"ui_text_input","z":"32365555.427b8a","name":"","label":"ch2 Temperature","tooltip":"","group":"ed9afc55.3641c","order":5,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"channels/ch2/temperature","x":345.01727294921875,"y":333.6649446487427,"wires":[["43652d83.ab56e4"]]},{"id":"f69d85bf.e940d8","type":"mqtt out","z":"32365555.427b8a","name":"","topic":"","qos":"2","retain":"true","broker":"a86bbd8c.6015c","x":564.8506164550781,"y":625.9982948303223,"wires":[]},{"id":"8b592c1.9d4c9d","type":"ui_text_input","z":"32365555.427b8a","name":"","label":"ch1 power","tooltip":"","group":"ed9afc55.3641c","order":2,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"channels/ch1/power","x":337.85047149658203,"y":549.664909362793,"wires":[["f69d85bf.e940d8"]]},{"id":"acfc18b4.fdd858","type":"ui_text_input","z":"32365555.427b8a","name":"","label":"ch2 power","tooltip":"","group":"ed9afc55.3641c","order":4,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"channels/ch2/power","x":338.85047149658203,"y":608.6649122238159,"wires":[["f69d85bf.e940d8"]]},{"id":"e25d7ab5.83ea68","type":"ui_text_input","z":"32365555.427b8a","name":"","label":"ch3 Temperature","tooltip":"","group":"ed9afc55.3641c","order":9,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"channels/ch3/temperature","x":346.8505744934082,"y":389.9982385635376,"wires":[["43652d83.ab56e4"]]},{"id":"8a40798a.383948","type":"ui_text_input","z":"32365555.427b8a","name":"","label":"ch3 power","tooltip":"","group":"ed9afc55.3641c","order":8,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"channels/ch3/power","x":341.85055923461914,"y":659.9982423782349,"wires":[["f69d85bf.e940d8"]]},{"id":"e4696319.043eb","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":9,"width":0,"height":0,"name":"","label":"ch3 2x temperature","format":"{{msg.payload}}","layout":"row-spread","x":1274.870231628418,"y":452.00214672088623,"wires":[]},{"id":"6100461e.f1d6f8","type":"switch","z":"32365555.427b8a","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"ch1/temperature","vt":"str"},{"t":"eq","v":"ch1/power","vt":"str"},{"t":"eq","v":"ch2/temperature","vt":"str"},{"t":"eq","v":"ch2/power","vt":"str"},{"t":"eq","v":"ch3/temperature","vt":"str"},{"t":"eq","v":"ch3/power","vt":"str"},{"t":"eq","v":"ch4/temperature","vt":"str"},{"t":"eq","v":"ch4/power","vt":"str"}],"checkall":"true","repair":false,"outputs":8,"x":1011.7490615844727,"y":409.1154079437256,"wires":[["9798da6e.37b368"],["adc63a51.b0f5b8"],["3ced53d0.e4af6c"],["a8866ac8.d85b28"],["e4696319.043eb"],["4089b68c.533f78"],["89fdec0c.6eeac"],["e8fbcbe1.805918"]]},{"id":"adc63a51.b0f5b8","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":2,"width":0,"height":0,"name":"","label":"ch1 2x power","format":"{{msg.payload}}","layout":"row-spread","x":1259.8701095581055,"y":278.0021276473999,"wires":[]},{"id":"a8866ac8.d85b28","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":4,"width":0,"height":0,"name":"","label":"ch2 2x power","format":"{{msg.payload}}","layout":"row-spread","x":1266.8701095581055,"y":397.0021085739136,"wires":[]},{"id":"4089b68c.533f78","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":8,"width":0,"height":0,"name":"","label":"ch3 2x power","format":"{{msg.payload}}","layout":"row-spread","x":1272.8701438903809,"y":495.00211811065674,"wires":[]},{"id":"1db35fec.5c3c1","type":"ui_text_input","z":"32365555.427b8a","name":"","label":"ch4 Temperature","tooltip":"","group":"ed9afc55.3641c","order":11,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"channels/ch4/temperature","x":358.0173454284668,"y":438.99821281433105,"wires":[["43652d83.ab56e4"]]},{"id":"91b28199.7eda4","type":"ui_text_input","z":"32365555.427b8a","name":"","label":"ch4 power","tooltip":"","group":"ed9afc55.3641c","order":10,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"channels/ch4/power","x":335.0173454284668,"y":716.998212814331,"wires":[["f69d85bf.e940d8"]]},{"id":"89fdec0c.6eeac","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":11,"width":0,"height":0,"name":"","label":"ch4 2x temperature","format":"{{msg.payload}}","layout":"row-spread","x":1279.0173931121826,"y":548.9982080459595,"wires":[]},{"id":"e8fbcbe1.805918","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":10,"width":0,"height":0,"name":"","label":"ch4 2x power","format":"{{msg.payload}}","layout":"row-spread","x":1277.0173053741455,"y":591.99817943573,"wires":[]},{"id":"17e1e4ee.b8058b","type":"ui_text","z":"32365555.427b8a","group":"ed9afc55.3641c","order":1,"width":0,"height":0,"name":"","label":"Ch1-2 Control","format":"{{msg.payload}}","layout":"row-spread","x":354.79040145874023,"y":180.0397548675537,"wires":[]},{"id":"993e14cc.af4a78","type":"ui_text","z":"32365555.427b8a","group":"ed9afc55.3641c","order":7,"width":0,"height":0,"name":"","label":"Ch3-4 Control","format":"{{msg.payload}}","layout":"row-spread","x":351.01203536987305,"y":216.99999046325684,"wires":[]},{"id":"8f53d803.898af8","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":1,"width":0,"height":0,"name":"","label":"Ch1-2 Results","format":"{{msg.payload}}","layout":"row-spread","x":558.0121231079102,"y":178.99999237060547,"wires":[]},{"id":"a61ca161.3cb0d","type":"ui_text","z":"32365555.427b8a","group":"4c5a5b82.312a34","order":7,"width":0,"height":0,"name":"","label":"Ch3-4 Results","format":"{{msg.payload}}","layout":"row-spread","x":558.2336616516113,"y":217.9602222442627,"wires":[]},{"id":"981a0b63.12b308","type":"debug","z":"32365555.427b8a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":925.0777244567871,"y":296.83112144470215,"wires":[]},{"id":"e3d67dbb.bdbab","type":"subflow:e89e1a81.ab1328","z":"32365555.427b8a","name":"","env":[],"x":789.0743522644043,"y":415.82068824768066,"wires":[["6100461e.f1d6f8"]]},{"id":"a86bbd8c.6015c","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"4c5a5b82.312a34","type":"ui_group","z":"","name":"Ch Results","tab":"edb965df.f9c828","order":3,"disp":false,"width":"6","collapse":false},{"id":"ed9afc55.3641c","type":"ui_group","z":"","name":"Ch Controls","tab":"edb965df.f9c828","order":2,"disp":false,"width":"6","collapse":false},{"id":"edb965df.f9c828","type":"ui_tab","z":"","name":"home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]