How do you structure your flow in Node-Red?

Hi,
In my quest to design and select a good infrastructure for my digital home system, today I’m looking at automation and flow. Node-red seem to be a great visual flow but I’m interest on how you structure your flows when you start to have many and complex automation, so It doesn’t get into a flat hierarchy spaghetti and reach a limitation to expand or troubleshoot.

Thanks

I fully agree that structuring the code is not well supported in NR but maybe this is coming soon (there are some activities on the Node-Red forum)

I have migrated all my automation tasks to NR and using HA as front-end or for components where I don’t have a NR-Node(yet).

  • I have spread my Automations over a large number of TABs (i think I have 40+) tabs. I know that sounds crazy but it helps to keep the code clean and simple
  • I have my own naming convention for the Tabs (Dev-Alexa, Dev-HUE_Lights, Dev-Xiomi, Auto-Lights, Auto-Temp, Auto-Alarm,…) to make it easier to find the correct tab (as well when you link your flows)
  • I always try to break-down my automation in functional groups to be more flexible and to re-use already existing nodes
    —> Turn on/off a component (Light, Speaker, Switch, Automation, etc)
    —> Read/Write a value from/to a component( Set light color, send TTS to speaker, get temperature,etc)
    —> Simple and complex node-flows using the above

I have a general rule for my automations:

if an automation does not fit on an one screen-view than break the flow appart :slight_smile:

2 Likes

Yeh, I use several separate flows (tabs) rather than being “clever” in one. It helps keep each layout simple and easy to follow.

1 Like

@xx_Nexus_xx @eggman Thanks for your inputs. Been using Insteon ISY994, I really appreciate to have a folder hierarchy for lights, script and rule. It is easy and intuitive to find the rule even after a few months.

In fact if I had to redesign it, I will have done the following (see screenshot).

  • Add on the far left side a file/flow windows resizable or closable per user request via arrow or minimize button…
  • Icon button on top similar to PSPAD software where you have select the view: Project flow, local/network flow, folder hierarchy, flat details list, etc.
  • Top tab flow will be similar to a Web browser, where it is only the working flow active and with (x) to close them.

Looking for you feedback if it is something you will find useful?

1 Like

Wow… that looks promising! I always love a nice structure and hierarchy … and it will great if this can be done!