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

**URL:** https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098
**Category:** Flows
**Tags:** flow
**Created:** [December 13, 2020, 11:24am UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098 "2020-12-13T11:24:52Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![hbeers](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hbeers/32/11743_2.png) [@hbeers](https://community.homey.app/u/hbeers)
#### Post date: [December 13, 2020, 11:24am UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/1 "2020-12-13T11:24:52Z")

</div>

Hi,

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!)

---

<div class="post-metadata">

### Author: ![Rocodamelshekima](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocodamelshekima/32/8209_2.png) [@Rocodamelshekima](https://community.homey.app/u/Rocodamelshekima)
#### Post date: [December 13, 2020, 11:30am UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/2 "2020-12-13T11:30:44Z")

</div>

> [@hbeers](#):
>
> I am still struggling with the situation that I have to evaluate three different conditions in one Flow.

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.  
 ![chrome_2020-12-13_12-33-51](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/6/e6c2c9852696e7bac34a0bb2d9a98390c8849e69.png)

---

<div class="post-metadata">

### Author: ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)
#### Post date: [December 13, 2020, 11:36am UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/3 "2020-12-13T11:36:18Z")

</div>

> [@hbeers](#):
>
> (ps. also a request to Athom to incorporate this in future development!)

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

[https://docs.google.com/forms/d/e/1FAIpQLSc8j\_GfID4adV4w5ogNtIX1-AqVWrkgIo3bOjkoNtqlHMM0xw/viewform](https://docs.google.com/forms/d/e/1FAIpQLSc8j_GfID4adV4w5ogNtIX1-AqVWrkgIo3bOjkoNtqlHMM0xw/viewform)

---

<div class="post-metadata">

### Author: ![hbeers](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hbeers/32/11743_2.png) [@hbeers](https://community.homey.app/u/hbeers)
#### Post date: [December 13, 2020, 11:49am UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/4 "2020-12-13T11:49:33Z")

</div>

thanks

---

<div class="post-metadata">

### Author: ![hbeers](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hbeers/32/11743_2.png) [@hbeers](https://community.homey.app/u/hbeers)
#### Post date: [December 13, 2020, 11:51am UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/5 "2020-12-13T11:51:47Z")

</div>

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 …

---

<div class="post-metadata">

### Author: ![Rocodamelshekima](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocodamelshekima/32/8209_2.png) [@Rocodamelshekima](https://community.homey.app/u/Rocodamelshekima)
#### Post date: [December 13, 2020, 11:53am UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/6 "2020-12-13T11:53:02Z")

</div>

> [@hbeers](#):
>
> I know, but then “within” the OR-condition I need to test multiple situations (AND function).

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

> [@hbeers](#):
>
> Besides that I am probably going to need more conditions to test than three …

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.

---

<div class="post-metadata">

### Author: ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)
#### Post date: [December 13, 2020, 12:07pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/7 "2020-12-13T12:07:05Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![hbeers](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hbeers/32/11743_2.png) [@hbeers](https://community.homey.app/u/hbeers)
#### Post date: [December 13, 2020, 12:26pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/8 "2020-12-13T12:26:00Z")

</div>

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 …

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/a/ba74af41590d7f1da735a13e663de3b05e63f0b0.png)

---

<div class="post-metadata">

### Author: ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)
#### Post date: [December 13, 2020, 1:52pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/9 "2020-12-13T13:52:04Z")

</div>

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.

**When…**  
Variable „Lights“ changed  
**And…**  
Variable “Lights = false” = Yes  
Variable “NightyNight = off” = Yes  
Someone at home = Yes  
**Then…**  
Lamp 1 off  
Lamp 2 off  
…

**When…**  
Variable “Lights” changed  
**And…**  
Variable “Lights = true” = Yes  
Variable “NightyNight = off” = Yes  
**Then…**  
Lamp 1 on  
Lamp 2 on  
…

---

<div class="post-metadata">

### Author: ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)
#### Post date: [December 13, 2020, 1:52pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/10 "2020-12-13T13:52:51Z")

</div>

> [@hbeers](#):
>
> Any suggestions

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?)

---

<div class="post-metadata">

### Author: ![Cheggen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/cheggen/32/27654_2.png) [@Cheggen](https://community.homey.app/u/Cheggen)
#### Post date: [October 17, 2021, 8:03pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/11 "2021-10-17T20:03:53Z")

</div>

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 🙂

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

---

<div class="post-metadata">

### Author: ![hbeers](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hbeers/32/11743_2.png) [@hbeers](https://community.homey.app/u/hbeers)
#### Post date: [October 18, 2021, 8:45am UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/12 "2021-10-18T08:45:14Z")

</div>

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” 😉

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

Thanks anyway for reacting !!!

---

<div class="post-metadata">

### Author: ![Adrian\_Rockall](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/adrian_rockall/32/13209_2.png) [@Adrian\_Rockall](https://community.homey.app/u/Adrian_Rockall)
#### Post date: [October 19, 2021, 4:15pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/13 "2021-10-19T16:15:24Z")

</div>

Have you looked at H.O.O.P [Homey Community Store](https://store.homey.community/app/nl.qluster-it.HOOP)  
That can enable some complex conditions in flows.

---

<div class="post-metadata">

### Author: ![BIRDY](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/birdy/32/41476_2.png) [@BIRDY](https://community.homey.app/u/BIRDY)
#### Post date: [July 27, 2022, 7:50pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/14 "2022-07-27T19:50:12Z")

</div>

This may have been already pausible with the classic flow but now with the advanced flow you can do it much more organised.

I made a DIY circular switch case using the advance flow to change radio station on a sonos speaker with a zigbee button check de printscreen. I hope this helps

 ![radio case counter](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/1/d1a44d19b8b9a0e4ee839811e9994433e3dfbb8c.jpeg)

---

<div class="post-metadata">

### Author: ![hbeers](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hbeers/32/11743_2.png) [@hbeers](https://community.homey.app/u/hbeers)
#### Post date: [August 18, 2022, 5:33am UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/15 "2022-08-18T05:33:33Z")

</div>

aaah, didn’t know that an advanced flow could be triggered by multiple events (e.g. ‘flow started’ OR ‘right button was long pressed’ OR ‘left button was long pressed’).

I seem not to be able to get something similar done.  
Does your flow **really** work ?

---

<div class="post-metadata">

### Author: ![BIRDY](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/birdy/32/41476_2.png) [@BIRDY](https://community.homey.app/u/BIRDY)
#### Post date: [August 18, 2022, 3:10pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/16 "2022-08-18T15:10:15Z")

</div>

Yes it works, are you using a counter to switch to the case of your choice?  
Share your flow maybe i can help

---

<div class="post-metadata">

### Author: ![Kevin\_Ponsen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kevin_ponsen/32/92414_2.png) [@Kevin\_Ponsen](https://community.homey.app/u/Kevin_Ponsen)
#### Post date: [November 29, 2023, 7:07pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/17 "2023-11-29T19:07:20Z")

</div>

something like this ?

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/a/bab24364d96acb3e3764d5051e0e670b7193cc3a.png)

---

<div class="post-metadata">

### Author: ![Rudi\_Hendrix](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rudi_hendrix/32/31931_2.png) [@Rudi\_Hendrix](https://community.homey.app/u/Rudi_Hendrix)
#### Post date: [January 4, 2026, 2:10pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/18 "2026-01-04T14:10:25Z")

</div>

Very old thread…. I know… However, a case statement would be very useful.

For example for running different actions given a selected scene or mood. I have a lot of lights and devices triggered by activity in a specific room. However, if for example the variable “Dagverlichting” is enabled, I want the lights and device to act different than when “Sfeerverlichting” is enabled. I also want them to act different when “Bedtijd” is active. That sort of stuff. A case statement immediately after the trigger could be useful here. And yes, now I have also solved it by having all sort of nested If…then… else statements. And yes, the risk you run with a case statement is that the system acts weird in case (as in my example) both “Sfeerverlichting” and “Dagverlichting” are enabled.

---

<div class="post-metadata">

### Author: ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)
#### Post date: [January 4, 2026, 2:25pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/19 "2026-01-04T14:25:14Z")

</div>

Not sure (as I haven’t tried it myself), but maybe this app is usefull. It seems to allow you to evaluate multiple criteria at once:

- [Smart (Components) Toolkit](https://homey.app/en-nl/app/no.tiwas.booleantoolbox/Smart-(Components)-Toolkit/)
- [[APP] Smart (Components) Toolkit (was: Boolean Toolbox) - Create advanced logic with simple formulas](https://community.homey.app/t/app-smart-components-toolkit-was-boolean-toolbox-create-advanced-logic-with-simple-formulas/143906)

---

<div class="post-metadata">

### Author: ![Rudi\_Hendrix](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rudi_hendrix/32/31931_2.png) [@Rudi\_Hendrix](https://community.homey.app/u/Rudi_Hendrix)
#### Post date: [January 4, 2026, 2:58pm UTC](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098/20 "2026-01-04T14:58:21Z")

</div>

Thanks! I can definitely look into that

[Next page](https://community.homey.app/t/including-a-case-or-switch-statement-in-flows-to-evaluate-more-than-two-conditions/39098.md?page=2)
