# Conditional Concepts

**URL:** https://community.homey.app/t/conditional-concepts/8844
**Category:** Questions & Help
**Created:** [February 5, 2019, 10:13pm UTC](https://community.homey.app/t/conditional-concepts/8844 "2019-02-05T22:13:10Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Ferry\_van\_E](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ferry_van_e/32/10953_2.png) [@Ferry\_van\_E](https://community.homey.app/u/Ferry_van_E)
#### Post date: [February 5, 2019, 10:13pm UTC](https://community.homey.app/t/conditional-concepts/8844/1 "2019-02-05T22:13:10Z")

</div>

Hi guys, i’m a newbie so you will probably have a good laugh now and then.

I seem to be having trouble understanding the concept of if …(A)… and …(B)… or …©… then…(D)… else …(E)…

To my understanding:

If A and B are true then D  
If A and C are true then E

So i’ve created a flow to watch tv based on the time of the day with sun events. Whether i need a light scene (Hue) in the living room during this flow depends on the time of the day.

A = when someone says ‘i would like to watch tv’  
B = it is between sunrise and sunset  
C = it is after sunset  
D = turn on tv, receiver, set volume  
E = turn on tv, receiver, set volume, activate ‘Chill-scene’ (Hue)

I’ve tried this tonight (after sunset) but the checkmarks appear next to events of D where i expected the checkmarks to appear next to E

What do i miss here?

---

<div class="post-metadata">

### Author: ![Yianni](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/yianni/32/9675_2.png) [@Yianni](https://community.homey.app/u/Yianni)
#### Post date: [February 5, 2019, 10:49pm UTC](https://community.homey.app/t/conditional-concepts/8844/2 "2019-02-05T22:49:37Z")

</div>

If… then… else, have greater precedence over AND, OR. The way they homey app works is give OR precedence over AND

So, If A and B are true then D is correct. But ‘if A and C are true then E’ is not correct, D would ‘run’. With parentheses it’s more clear maybe  
if (A and B) OR © THEN (D) else (E)

The thing is you can recreate a different behavior by duplicating cards. So,  
If (A and B) OR (A and C)  
would be the same as  
If (A) AND (B OR C)

You just need to notice which one takes precedence.

---

<div class="post-metadata">

### Author: ![Ferry\_van\_E](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ferry_van_e/32/10953_2.png) [@Ferry\_van\_E](https://community.homey.app/u/Ferry_van_E)
#### Post date: [February 5, 2019, 11:20pm UTC](https://community.homey.app/t/conditional-concepts/8844/3 "2019-02-05T23:20:01Z")

</div>

> [@Central flow request topic](https://community.homey.app/t/central-flow-request-topic/8774/3):
>
> So, If A and B are true then D is correct. But ‘if A and C are true then E’ is not correct, D would ‘run’. With parentheses it’s more clear maybe  
> if (A and B) OR © THEN (D) else (E)
> 
> The thing is you can recreate a different behavior by duplicating cards. So,  
> If (A and B) OR (A and C)  
> would be the same as  
> If (A) AND (B OR C)

Thanks Yianni, but is still don’t get it. How should i configure my flow then?

For ‘IF’ i can only use 1 card so it is not possible to duplicate cards using A twice.

---

<div class="post-metadata">

### Author: ![Jamie](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jamie/32/5274_2.png) [@Jamie](https://community.homey.app/u/Jamie)
#### Post date: [February 6, 2019, 1:25am UTC](https://community.homey.app/t/conditional-concepts/8844/4 "2019-02-06T01:25:48Z")

</div>

I could be wrong but would a simple if/else statement work for you what you want?

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

The main change which simplifies things is - if its not day time, then it must be night time and you don’t need the ‘or’.

---

<div class="post-metadata">

### Author: ![Yianni](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/yianni/32/9675_2.png) [@Yianni](https://community.homey.app/u/Yianni)
#### Post date: [February 6, 2019, 9:03am UTC](https://community.homey.app/t/conditional-concepts/8844/5 "2019-02-06T09:03:04Z")

</div>

Sorry I misunderstood your post. Looking back at the original post, it seems it should work. You created two separate flows, right?

---

<div class="post-metadata">

### Author: ![Ferry\_van\_E](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ferry_van_e/32/10953_2.png) [@Ferry\_van\_E](https://community.homey.app/u/Ferry_van_E)
#### Post date: [February 6, 2019, 9:50am UTC](https://community.homey.app/t/conditional-concepts/8844/6 "2019-02-06T09:50:33Z")

</div>

@Jamie, thanks for your next-level explanation 👌🏽

I do not need the day condition indeed. I just needed to understand how to make use of IF AND THEN ELSE.

Earlier i found a small explanation in Dutch by Athom. I wonder if their instruction was written correctly or i just simply misunderstood.

[Dutch Athom explanation](https://support.athom.com/hc/nl/articles/360015464674-Hoe-gebruik-je-of-en-anders-in-een-Flow)

According to this i came up with my A, B, C, D, E in my initial post

---

<div class="post-metadata">

### Author: ![Ferry\_van\_E](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ferry_van_e/32/10953_2.png) [@Ferry\_van\_E](https://community.homey.app/u/Ferry_van_E)
#### Post date: [February 6, 2019, 1:55pm UTC](https://community.homey.app/t/conditional-concepts/8844/7 "2019-02-06T13:55:21Z")

</div>

How come the amount of options for time & date for IF are less than the amount of options for time & date for AND?

I was experimenting with a flow where Sonos plays a playlist if there is a change in brightness in a Hue bulb (me saying ‘Hey Siri, let’s eat’ which dims the lights in the kitchen) and the time is between 18:00 and 19:00

I would like to take in account that there is a possibility the lights are ON. The change of brightness won’t work in that case.

If i could use IF ‘time is between’ AND hue bulb brightness changes OR hue bulb is ON THEN start PLAY3 Kitchen and playlist ‘xxx’

Probably a good test for me whether i finally understand how to setup flows. I don’t want to disappoint @jamie after his explanation above 😉

---

<div class="post-metadata">

### Author: ![Jamie](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jamie/32/5274_2.png) [@Jamie](https://community.homey.app/u/Jamie)
#### Post date: [February 7, 2019, 12:09am UTC](https://community.homey.app/t/conditional-concepts/8844/9 "2019-02-07T00:09:49Z")

</div>

@Ferry_van_E I’ve moved your question out of the flow request thread as it wasn’t appropriate there.

---

<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, 6:00am UTC](https://community.homey.app/t/conditional-concepts/8844/10 "2019-02-07T06:00:16Z")

</div>

> [@Ferry\_van\_E](#):
>
> If i could use IF ‘time is between’ AND hue bulb brightness changes OR hue bulb is ON THEN start PLAY3 Kitchen and playlist ‘xxx’

At what moment would this flow run? I think you mean the following?

- when HUE brightness changes and time between then play  
and
- when light goes on and time between then play

---

<div class="post-metadata">

### Author: ![Ferry\_van\_E](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ferry_van_e/32/10953_2.png) [@Ferry\_van\_E](https://community.homey.app/u/Ferry_van_E)
#### Post date: [February 7, 2019, 10:49am UTC](https://community.homey.app/t/conditional-concepts/8844/11 "2019-02-07T10:49:14Z")

</div>

> [@bvdbos](#):
>
> At what moment would this flow run? I think you mean the following?
> 
> - when HUE brightness changes and time between then play  
> and
> - when light goes on and time between then play

I guess i have to create 2 flows. I cannot set a ‘between time’ for IF. There are less time options for IF compared to THEN. Why is this anyway?

---

<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, 11:07am UTC](https://community.homey.app/t/conditional-concepts/8844/12 "2019-02-07T11:07:47Z")

</div>

Like said a couple of times before “a time between” is not a moment something happens… When do you see this working? if it’s 18.00 hours? Or if it’s 18:07:00 hours? Or 18:07:01 hours? And how often would this flow run then?

---

<div class="post-metadata">

### Author: ![Ferry\_van\_E](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ferry_van_e/32/10953_2.png) [@Ferry\_van\_E](https://community.homey.app/u/Ferry_van_E)
#### Post date: [February 7, 2019, 11:50am UTC](https://community.homey.app/t/conditional-concepts/8844/13 "2019-02-07T11:50:49Z")

</div>

I’m new to this so it is clear i have to get used to a certain point of view. I now understand what you mean by ‘a time between’ is not an event.

Let’s say i would like to start this flow when the time is 18:00. In my believe nothing will happen if the Hue bulb changes brightness at 18:15.

Therefore i have to create 2 flows as you mentioned earlier:  
IF Hue brightness changes AND time is between 18:00-19:00 THEN start play3 with playlist x

IF HUE bulb is switched ON AND time is between 18:00-19:00 THEN start Play3 with playlist x

I guess i will have to understand that it is not always possible to put all of your demands in 1 flow.

Like i said. One big learning process. Thanks for your help!

---

<div class="post-metadata">

### Author: ![Jamie](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jamie/32/5274_2.png) [@Jamie](https://community.homey.app/u/Jamie)
#### Post date: [February 7, 2019, 11:51am UTC](https://community.homey.app/t/conditional-concepts/8844/14 "2019-02-07T11:51:27Z")

</div>

What @bvdbos is trying to explain is the concept of a trigger or ‘when’.

This is the part which tells the flow WHEN it should run . Not the requirements of the flow to run.

Triggers are one off, ie. When sunsets - When a light is turned on, - When you come home, etc.

WHEN - Trigger  
IF - Condition  
THEN - Action.

I hope this helps.

---

<div class="post-metadata">

### Author: ![Ferry\_van\_E](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ferry_van_e/32/10953_2.png) [@Ferry\_van\_E](https://community.homey.app/u/Ferry_van_E)
#### Post date: [February 7, 2019, 11:55am UTC](https://community.homey.app/t/conditional-concepts/8844/15 "2019-02-07T11:55:50Z")

</div>

> [@Jamie](#):
>
> This is the part which tells the flow WHEN it should run . Not the requirements of the flow to run.
> 
> Triggers are one off, ie. When sunsets - When a light is turned on, - When you come home, etc.
> 
> WHEN - Trigger  
> IF - Condition  
> THEN - Action.

Thanks @Jamie. This is clear. How does this make sense for the flow creator below? I do not see WHEN

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/f/fc1e109da660cd7c5e95c9864e36d8ccd69e5d1f.jpeg)

---

<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, 11:58am UTC](https://community.homey.app/t/conditional-concepts/8844/16 "2019-02-07T11:58:09Z")

</div>

“When” translates to “Als”

---

<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, 12:51pm UTC](https://community.homey.app/t/conditional-concepts/8844/17 "2019-02-07T12:51:17Z")

</div>

Als =\> When  
En =\> AND  
Dan =\> THEN
