Homey Community Forum

Including a 'case' or 'switch' statement in flows to evaluate more than two conditions


I am still struggling with the situation that I have to evaluate three different conditions in one Flow.

Although I am quite experienced in JScript I’d rather fix this in Flows. This way people who are not so confident with JScript will be able to test more than one condition too, thus creating more advanced flows.

Any suggestions anybody?

(ps. also a request to Athom to incorporate this in future development!)

Can u give an example ?
Because with the OR function u can test 3 alr.
Hit the AND card, hold it for a second and then drag it down. The OR card appears.

For that you can make a feature request, Athom isn’t present in the community forum.


I know, but then “within” the OR-condition I need to test multiple situations (AND function).
Besides that I am probably going to need more conditions to test than three …

Thanks for your reply though …

U can add as many cards as u like within the OR function?

For that u need to make a request. They don’t tell us how many peeps requested this alr but there has been a lot of them me guess, good luck on that one.

Why don’t you give an example? With multiple flows it is also possible to check more than 3 conditions or 3 groups of conditions.

That’s what I did until now. But ‘maintenance’ is a bit more complicated then …
I’ll show you the flowchart … and then there is even a third condition that switches the “nightynight” variable, triggering another set of actions to be performed …

Sorry, but don’t understand exactly what is what.
Is „Lights changed?“ a variable?

If „Lights“ is a variable, the flows should look like this.
However, I think that the flow chart is generally wrong or not logical built. For example, the variable “Lights” is checked twice. The yellow colored diamonds are therefore unnecessary.

Variable „Lights“ changed
Variable “Lights = false” = Yes
Variable “NightyNight = off” = Yes
Someone at home = Yes
Lamp 1 off
Lamp 2 off

Variable “Lights” changed
Variable “Lights = true” = Yes
Variable “NightyNight = off” = Yes
Lamp 1 on
Lamp 2 on

In the first flow you can make desisions for 1 case, with the Else, you can jump to the next flow to flter the second case and so on. (No it’s not possible in 1 flow but who cares?)

Hi hbeers! I know im stepping in a bit late here, but I have just had my first encounter with the need for a case switch, and I found a solution that might be useful for you as well, so I’ll share it anyway :slight_smile:

My challenge was to find a way for the lights in the living room to “adapt” to the time of day. Im operating with 3 cases: “day”, “evening” and “night”. In addition i wanted the solution not only to trigger the correct flow when i turn the lights on, but also to change the lights if it changes from day to evening while the lights are on.

so, I created a logical text variabel called “flow_name”, and a script called “Start Flow”.
“flow_name” should contain the name of a flow, set manually or by an other flow (or script).
The script reads the flow-name in “flow_name” and triggers the flow.

This setup allows me to have one set of flows that maintains the time of days in terms of updating the “flow_name” with the name of one of the 3 flows: “light_day”, “light_evening” or “light_night”. Then, when i need to turn the lights on (or change the light) i simply call the script.

If your still in here, I’m curious to hear what you think of my solution, and if you have any suggestions for improvements!

// Christian

1 Like

HI Christian,

I know … I’ve tried something similar.
Thing is that when you have a couple of such situations, it is going to be very complicated to ‘maintain’ these flows. You know … “trees and forest” :wink:

So I really would like Athom supply a ‘switch’ condition for ease of use …

Thanks anyway for reacting !!!

1 Like

Have you looked at H.O.O.P Homey Community Store
That can enable some complex conditions in flows.