Example flow
[{"id":"5e83fee07ef4ea01","type":"inject","z":"da8a6ef0b3c9a5c8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"mac\":\"xx:01:01:01:zz:yy\",\"command\":\"1\"}","payloadType":"json","x":210,"y":4580,"wires":[["bf5fbbafd94a885f"]]},{"id":"bf5fbbafd94a885f","type":"function","z":"da8a6ef0b3c9a5c8","name":"function 20","func":"const topics =[\n \"esp32027/cmd/cmd_for_sender\",\n \"esp32029/cmd/cmd_for_sender\",\n \"esp32030/cmd/cmd_for_sender\"\n];\ntopics.forEach(str => {\n msg.topic = str;\n node.send(msg);\n})\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":4600,"wires":[["eb74b20280fde506","948c50cb943cd974"]]},{"id":"d4accf76111fbe5b","type":"inject","z":"da8a6ef0b3c9a5c8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"mac\":\"xx:01:01:01:zz:yy\",\"command\":\"2\"}","payloadType":"json","x":210,"y":4620,"wires":[["bf5fbbafd94a885f"]]},{"id":"eb74b20280fde506","type":"debug","z":"da8a6ef0b3c9a5c8","name":"debug 231","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":4660,"wires":[]},{"id":"948c50cb943cd974","type":"mqtt out","z":"da8a6ef0b3c9a5c8","name":"","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e8ba3ef5.22f4a8","x":690,"y":4580,"wires":[]},{"id":"e8ba3ef5.22f4a8","type":"mqtt-broker","name":"testb","broker":"192.168.1.25","port":"1883","clientid":"node-red-test","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
Simple example of selecting mac and command frow ui_dashboard dropdowns and sending to all topics. This is a simple example and will require some validation and checks before sending payloads to topics.
[{"id":"40af0b19a53969e3","type":"ui_dropdown","z":"da8a6ef0b3c9a5c8","name":"","label":"Mac's","tooltip":"","place":"Select option","group":"2d4fe667.28f8ba","order":19,"width":0,"height":0,"passthru":false,"multiple":false,"options":[{"label":"xx:01:01:01:zz:yy","value":"xx:01:01:01:zz:yy","type":"str"},{"label":"xx:01:01:01:zz:xx","value":"xx:01:01:01:zz:xx","type":"str"},{"label":"xx:01:01:01:zz:zz","value":"xx:01:01:01:zz:zz","type":"str"}],"payload":"","topic":"mac","topicType":"str","className":"","x":310,"y":4660,"wires":[["b5abf9ac49ebd729"]]},{"id":"b5abf9ac49ebd729","type":"join","z":"da8a6ef0b3c9a5c8","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":490,"y":4660,"wires":[["bf5fbbafd94a885f"]]},{"id":"f993227bc94e2cd7","type":"ui_dropdown","z":"da8a6ef0b3c9a5c8","name":"","label":"","tooltip":"","place":"Select option","group":"2d4fe667.28f8ba","order":20,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"ota","value":"1","type":"str"},{"label":"restart","value":"2","type":"str"},{"label":"captive","value":"3","type":"str"}],"payload":"","topic":"command","topicType":"str","className":"","x":340,"y":4720,"wires":[["b5abf9ac49ebd729"]]},{"id":"bf5fbbafd94a885f","type":"function","z":"da8a6ef0b3c9a5c8","name":"function 20","func":"const topics =[\n \"esp32027/cmd/cmd_for_sender\",\n \"esp32029/cmd/cmd_for_sender\",\n \"esp32030/cmd/cmd_for_sender\"\n];\nmsg.payload = {\n command: msg.payload.command, \n mac: msg.payload.mac\n};\n \ntopics.forEach(str => {\n msg.topic = str;\n node.send(msg);\n})\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":650,"y":4660,"wires":[["eb74b20280fde506"]]},{"id":"eb74b20280fde506","type":"debug","z":"da8a6ef0b3c9a5c8","name":"debug 231","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":4660,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]