# Handling Else-If scenarios in flows

**URL:** <https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870>\
**Category:** Questions & Help\
**Created:** [February 7, 2019, 4:12pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870 "2019-02-07T16:12:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Thornton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_thornton/32/5109_2.png) [@Peter\_Thornton](https://community.homey.app/u/Peter_Thornton)\
**Post date:** [February 7, 2019, 4:12pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/1 "2019-02-07T16:12:53Z")

</div>

Hi everyone.  
I know, that Homey do not support else if in flows so until they add that (fingers crossed) how do you handle this?

Being a developer im dying because of the missing else if possibilities so ill like to hear if you have any tips/suggestions how to work around this - without ending up with 1000 flows.

Sorry if this has been asked before, but i was not able to find and concrete in the forums.

---

<div class="post-metadata">

**Author:** ![Jeroen\_Somhorst](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jeroen_somhorst/32/184_2.png) [@Jeroen\_Somhorst](https://community.homey.app/u/Jeroen_Somhorst)\
**Post date:** [February 7, 2019, 4:24pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/2 "2019-02-07T16:24:43Z")

</div>

Hi,

do you have an example of a flow you want to add which you can’t do right now? I’m a developer myself and yes it is sometimes a bit cumbersome (making 3 flows for something that seems to be able in 1 ) but most of the time I manage to do so.

---

<div class="post-metadata">

**Author:** ![Peter\_Thornton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_thornton/32/5109_2.png) [@Peter\_Thornton](https://community.homey.app/u/Peter_Thornton)\
**Post date:** [February 7, 2019, 4:35pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/3 "2019-02-07T16:35:09Z")

</div>

At the moment it’s not that I’m not able to do what I want. But as you say it takes 3 or more flows for something that should/could be done in one.

So I just thought someone might have found the holy grail.

But a simple one could be reacting to a event with a value

When event SetLightMode  
And EventValue == Normal  
Then SetSomeLight  
Else if EventValue == Dimmed  
Then SetSomeOtherLight  
Else if EventValue == Movie  
Then SetSomeThirdLight

---

<div class="post-metadata">

**Author:** ![Jeroen\_Somhorst](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jeroen_somhorst/32/184_2.png) [@Jeroen\_Somhorst](https://community.homey.app/u/Jeroen_Somhorst)\
**Post date:** [February 7, 2019, 4:40pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/4 "2019-02-07T16:40:23Z")

</div>

Unfortunatly that is not possible and I guess will never be. This is due to the target audience of Homey. It is, as far as I understand, aimed at casual customers. It’s not, like domoticz or something similar, aimed to tech people 😉

---

<div class="post-metadata">

**Author:** ![bvdbos](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bvdbos/32/2352_2.png) [@bvdbos](https://community.homey.app/u/bvdbos)\
**Post date:** [February 7, 2019, 4:43pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/5 "2019-02-07T16:43:21Z")

</div>

[http://homeyscript.athom.com/](http://homeyscript.athom.com/) for the more technical people 🙂

---

<div class="post-metadata">

**Author:** ![Peter\_Thornton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_thornton/32/5109_2.png) [@Peter\_Thornton](https://community.homey.app/u/Peter_Thornton)\
**Post date:** [February 7, 2019, 4:59pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/6 "2019-02-07T16:59:53Z")

</div>

I understand that they want to keep it simple for the “normal” user. But why not just add an “advanced” mode for the rest of us.  
I know I havde done so many times in various projects.

I know about homeyscript, but the second I start doing that, I stop everyone else in the house from editing the flows - the can easily understand a basic if then else if then flow, but from there and a UI to homeyscript is a long, long way.

---

<div class="post-metadata">

**Author:** ![johan\_bendz](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/johan_bendz/32/10344_2.png) [@johan\_bendz](https://community.homey.app/u/johan_bendz)\
**Post date:** [February 7, 2019, 5:06pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/7 "2019-02-07T17:06:07Z")

</div>

The best alternative you can have, not using Homeyscript, is to have multiple flows or use an app like [https://apps.athom.com/app/name.klep.flow-event-bus](https://apps.athom.com/app/name.klep.flow-event-bus).

---

<div class="post-metadata">

**Author:** ![Peter\_Thornton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_thornton/32/5109_2.png) [@Peter\_Thornton](https://community.homey.app/u/Peter_Thornton)\
**Post date:** [February 7, 2019, 5:23pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/8 "2019-02-07T17:23:47Z")

</div>

I concluded that as well.

The eventbus is great but unfortunately you are not able to use the event values in neither the “and” or the “then”  
And that is a damn shame 🙁

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [February 7, 2019, 5:36pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/9 "2019-02-07T17:36:15Z")

</div>

Events are ephemeral, but you could look at using variables instead.

---

<div class="post-metadata">

**Author:** ![Peter\_Thornton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_thornton/32/5109_2.png) [@Peter\_Thornton](https://community.homey.app/u/Peter_Thornton)\
**Post date:** [February 7, 2019, 5:38pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/10 "2019-02-07T17:38:50Z")

</div>

Yes and that is the problem.  
As a developer I would expect to be able to handle the events payload.

Variables is a solution but honestly it sucks.

---

<div class="post-metadata">

**Author:** ![Pascal\_Nohl](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pascal_nohl/32/164446_2.png) [@Pascal\_Nohl](https://community.homey.app/u/Pascal_Nohl)\
**Post date:** [April 5, 2021, 9:00am UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/11 "2021-04-05T09:00:57Z")

</div>

I’m a little bit late in this discussion, but I’m also a developer and I’m missing a bunch of features in Homey. Personally I think that an “if then else” would be a big advantage and if done right an easy to understand logic for causual users.

BUT, what I’m really missing and that’s a pain are two things.

**1.** A flow that han have "When → AND → AND NOT → Then  
Why? Simple example. I have two windows in my kitchen and one thermostatic valve. I simply want to say: When window 1 closes and window 2 still open do nothing. When window 1 closes and window 2 closed set valve to heating. With the actual system, in the AND I have just the option “Window 2 is open” (no window 2 is closed) and that seems to be the same for most flows, the arguments in the AND do not show NOT values. So if the flow would accept AND NOT, I could at least place the “Window 2 is open” under it and it would do the job.  
**2.** A presentation that shows flows as groups and indended if they are called in a flow. A clear presentation as in a programming language. That would not confuse causual users, but improve the readability.

Actually, I try to work around with variables like an open window counter in the kitchen. But this needs handling of the variables in the physically triggered flows and handling the second level by triggers on the variables. This is complicated compared to just an AND NOT card, makes everything unreadable and I have to document my flows to get an overview. The major downside of this is that after a restart of the homey, the variables may not reflect the truth (a window has been opened meanwhile).

Homey is either a very light solution for beginners with super limited possibilities, or a much to heavy solution by using script. An ELSE logic and a AND NOT section would make it usable for beginners, advanced users and programmers. It’s a shame that such a cool system is laking these features + weak z-Wave performance. Come on Homey, add a set of connectors to your sphere and offer external antennas on cables for Z-Wave and Zigbee as accessory to plug in (some users did the mod themselves - it’s nearly zero development) and add some features to your flow and you have THE ULTIMATE system on the market.

---

<div class="post-metadata">

**Author:** ![lucje](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lucje/32/16607_2.png) [@lucje](https://community.homey.app/u/lucje)\
**Post date:** [July 2, 2021, 7:40am UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/12 "2021-07-02T07:40:55Z")

</div>

What if something like this [https://www.openplcproject.com](https://www.openplcproject.com) would be integrated into Homey for the “professionals” ? Every problem concerning flows would be solved like timers, counters, arithmetic functions, complex programming constructions “if then else” constructors almost without boundaries, Modbus communications … using devices as actuators-sensors, having internal variables as markers. I know that IO and response times in Homey are on a different level then in a PLC but with a bit smart programming this issue can be solved if you ask me, you don’t need response times of milliseconds in a home automation system so slowing the PLC part down would be a double benefit because it would mean less CPU time and better synchronization between hard and software.  
If this software had like MQTT capabilities I would have installed it on a Pi already, using Homey as a gateway by now. No flows, just apps for communicating with different devices and all logic running on the PLC part. Is there someone here that can have a look to see if this would be possible to integrate it into Homey?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [August 8, 2021, 9:11pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/13 "2021-08-08T21:11:19Z")

</div>

Hi Pascal. I just stumbled on your post, I just wanted to respond.

> [@Pascal\_Nohl](#):
>
> When window 1 closes and window 2 still open do nothing. When window 1 closes and window 2 closed set valve to heating. With the actual system, in the AND I have just the option “Window 2 is open” (no window 2 is closed)

Maybe I misunderstand, but this is pretty straightforward to build.

**IF** a contact alarm changed to state off  
**AND** window1 contact is off  
**AND** window2 contact is off  
**THEN** switch heater ON  
**ELSE** switch heater OFF

And, if window1 is opened, and window2 is closed or open or the other way round;  
**IF** a contact alarm changed to state on  
**AND** window1 contact is on  
**OR** window2 contact is on  
**OR** window1 contact is on  
**AND** window2 contact is on  
**THEN** switch heater OFF

> [@Pascal\_Nohl](#):
>
> presentation that shows flows as groups and indended if they are called in a flow

+1 and I would like to add: some overview of which var is used in which flow(s).

I also want you and @lucje point to a neat flow editor app, which let you build flows way more flexible [H.O.O.P. (Hope) - Homey Object Oriented Programming](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709)

---

<div class="post-metadata">

**Author:** ![Tirrazo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tirrazo/32/55444_2.png) [@Tirrazo](https://community.homey.app/u/Tirrazo)\
**Post date:** [October 13, 2022, 7:55pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/14 "2022-10-13T19:55:23Z")

</div>

Hi,

How do I setup the last part of this flow in the advanced flow?  
It’s the “else” (ellers) at the bottom.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/0/109601f8fae367c8ea30d5c51a81901dfabdbebb.png)

The last two cards is under the condition “Else”, but there is a second else between these two.  
If all the conditions are set, the switch will turn on, else turn off.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 13, 2022, 10:28pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/15 "2022-10-13T22:28:17Z")

</div>

Below Så  
The top card is at the Then… part  
The bottom card is in the Else… part.

It’s like  
Then…  
-turn light 1 on  
and…  
-turn light 2 on  
Else…  
-turn light 1 off  
and…  
-turn light 2 off

---

<div class="post-metadata">

**Author:** ![Tirrazo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tirrazo/32/55444_2.png) [@Tirrazo](https://community.homey.app/u/Tirrazo)\
**Post date:** [October 14, 2022, 4:06pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/16 "2022-10-14T16:06:16Z")

</div>

Thank you!

So the plan is to turn the heater **switch on** if the price has changed & the current prices is right.  
If not, then keep the **switch off**.

Will this be the same as I set up above?

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/5/d57ec6e2959e1ec82b4f3e6b05d1aed226dba4d7.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 14, 2022, 10:05pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/17 "2022-10-14T22:05:55Z")

</div>

YW and yes that’s correct!

---

<div class="post-metadata">

**Author:** ![Tirrazo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tirrazo/32/55444_2.png) [@Tirrazo](https://community.homey.app/u/Tirrazo)\
**Post date:** [October 15, 2022, 7:31pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/18 "2022-10-15T19:31:15Z")

</div>

I am trying to make an advanced flow for charging my car.

I want the else condition (charger off) to be set if either the time is not right or the price is too high.

But is it possible to get information about which of the 24 hours the car will charge ( 12 hours of the cheapest?  
Like some kind of function, script or flow could check which hours is the cheapest and report back just for info.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/8/68d6477b438d4b8241f0dad6b59b6608bbc1b59b.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 15, 2022, 10:26pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/19 "2022-10-15T22:26:16Z")

</div>

It works like this, Kristian

 ![Screenshot 2022-10-16 at 00-24-56 1.HomeyPro Peter](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/4/644cc76b55657162da0c1f574e2a0cf4a1567693.png)

---

<div class="post-metadata">

**Author:** ![Tirrazo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tirrazo/32/55444_2.png) [@Tirrazo](https://community.homey.app/u/Tirrazo)\
**Post date:** [October 15, 2022, 11:01pm UTC](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870/20 "2022-10-15T23:01:59Z")

</div>

Thank you very much! 😊

[Next page](https://community.homey.app/t/handling-else-if-scenarios-in-flows/8870.md?page=2)
