Are there any best practices for building advanced flows?

I have been using a Homey 2019 for several years now. I have a large number of different devices with various protocols mixed together, ranging from lights and a multitude of sensors to shutters, and from heating with smart radiator valves to a weather station and more.

I started with Basic Flows, and later, when Advanced Flows became available, I gradually rebuilt all my flows.

At the moment, I have divided my flows into those that detect something, such as light levels, temperature, or presence, and those that control something, like shutters or lights.

The first category sets variables, and the second category is triggered when values in combinations of variables change.

The second category of flows is divided by the type of device to be controlled, e.g., lights. For lights, I have one large flow that controls all the lighting in the house.

The advantage of this approach is that there are relatively few flows. The disadvantage is that all the flows have become quite large and difficult to manage.

Now I’m considering rebuilding the second category and creating a flow for each room, where all relevant actions for that room, such as heating and lighting, are managed.

Now I’m wondering which option puts the least strain on the Homey: fewer large flows or many small flows? And what is the impact of using a large number of variables on the Homey?

Does Atom have an overview of best practices for building flows that balance the load on the Homey and the clarity of the flows?

1 Like

I asked this question some year ago and the answer is that it doesn’t matter whether you put all flows in one big advanced flow or split them up in small once.
Big flows might affect the browser and of course visability.

My suggestion is that you create folders for your rooms for lights and such, and folders for different types of sensors. Only have related flows in the same advanced flows.
Everything is moveable so you will not be stuck in what you decide.

Thank you for your suggestion. I think that’s a good option too.

1 Like

I took a little bit of inspiration from low code platforms like Mendix. I basically have 3 categories.

  1. Actions - These are regular flows that start with the card: “This flow is started” so they can be executed by users either manually from the app or from widgets or via an automated shortcut. They are very simple in their nature and they either change a specific state like presence or a custom variable, activate a mood, play music, etc.
  2. Listeners - These are advanced flows that listen to state changes from devices, apps, or presence. I name them after the app creates the listening flow card. Inside these flows there could be multiple sections based on different flow cards that triggers the flow. I can usually get around with using notes at the beginning of the flow to indicate exactly what the flow is for and what it does. Also, I try to keep these flows as simple as possible which brings me to the third category:
  3. Micro flows - Whenever a listener becomes to complex or I want to be able to reuse certain part of a flow, I break the flow up into micro flows. These flows start with the card: “This flow is started with …”. These flows are designed to have one specific task and are created to be as reusable as possible.

Generally this works ok for me. However there are also some downsides. The main complexity is of course in the listeners. And splitting the logic up in this way sometimes requires multiple advanced flows to do a single thing. For instance, in order to to let Sonos speak a good morning message when someone comes home, I have to program things in three different flows:

  1. In the Presence flow, I have the card “When the first person wakes up” connected a card “Start timer ‘good morning message debounce timer’ with 10s”.
  2. In the Countdown flow I have the card “Timer ‘good morning message debounce timer’ reaches 0” connected to the card “Calculate variable ‘hallway message’ as ‘Good morning’”.
  3. In the Motion flow, I have “When the Hallway motion sensor becomes active” connected to the hallway Sonos card "Say ‘hallway message’ at ‘50%’ and then to "Set variable ‘hallway message’ to ‘’.
  4. In the Presence flow, I also have a card “When the last person goes to sleep” connected to the card "Pause timer ‘good morning message debounce timer’.

It’s pretty comprehensive, but at least there is consistency.
see some screenshots of my setup.



2 Likes