Re-use/duplicate flows


Hi, I've just started tinkering with Node Red and have a couple decent flows going.

I'd like to setup a flow that subscribes to a few MQTT topics (auto mode [yes:no], trigger temperature and current temperature) to automate turning fans on or off. There are a few fans and so I need to duplicate the flow multiple times but I'd like to know if it's possible to set it up so that I only need to change one flow there-after instead of each one when making changes. Kind of like passing parameters to a function in most programming languages.

Maybe it would only be one flow but I'll have to parse my incoming MQTT topics to know which fan it's processing. Some of the mqtt payloads just store data in a context or flow object but the regularly updated current temperature payload would trigger the actual logic functions.

I'm not sure I'm explaining this adequately so if anyone's interested I can elaborate further.



you can have wildcard characters within a MQTT-in node (google MQTT WILDCARD)
The full topic is then passed within the msg so you can use a switch node to direct messages dependant on which can it is.



Look at subflows.