Dealing with variables when duplicating groups of nodes

Hi all !

I need to duplicate some parts of a flow as I need to get the same behavior and workflow to work with another device ( or let's say another identical feature of the same device)
My first idea was to make use of subflow, and make use of ENV variable to easily tweak copies of the sub-flow, but due to the use of dashboard nodes, this is not possible.

I tried to use different context, flow variables to make the change easier, but it has some limits, and I still need to modify the code quite a lot to make the copy of the group work seamlessly.

I know that for now there is no real workaround to use DB nodes in subflows, but how would you guys deal with that kind of situation ? I guess there can be some tricks to make the work easier when duplicating groups....

Here is a snapshot of the group and the different variables, I can also share some part of the code if that helps.

Many thanks !

Mmmm looks like that was not an easy topic...

Hopefully DB 2.0 will solve the problem related to subflows.

Anyway, if someone has any suggestion, feel free to share !


I would solve this by separating the logic from the dashboard nodes. I would use MQTT to publish all the data that is needed by the dashboard, and subscribe to topics that will get input from the dashboard. The subflow with the logic can be configured using subflow parameters so that it communicates using unique topics for that instance of the subflow.
If you only need to show one device on the dashboard at any one time then you can use some interface logic to decide which topics to send to the dashboard nodes.
If you need multiple devices visible at one time then you will have to duplicate the dashboard nodes and connect them via appropriately configured mqtt nodes.

Hi , thanks for your answer, which makes sense.

I must confess I know close to nothing about MQTT for the moment, as most of the external devices I communicate with use API based on TCP, websockets or Rest API, no MQTT. But I'll give it a deeper look if it can help improving this kind of situation.



To learn more about MQTT then see this tutorial MQTT Essentials - All Core Concepts Explained

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.