# How to create a flow trigered by event (when) OR event (when)?

**URL:** <https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957>\
**Category:** Questions & Help\
**Tags:** flow\
**Created:** [December 11, 2020, 12:01am UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957 "2020-12-11T00:01:01Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian13](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/christian13/32/27232_2.png) [@Christian13](https://community.homey.app/u/Christian13)\
**Post date:** [December 11, 2020, 12:01am UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/1 "2020-12-11T00:01:01Z")

</div>

Hi,

I would like to create a flow that opens my shutters when sun rises but not before 7h. This only from monday to friday and not in summer.

My flow should be like : IF (time = 7h) OR (sunrise AND time \> 7h) THEN open shutters

I have tried IF (sunrise) AND [(time \> 7h) AND (day in week) AND (it’s not summer)] THEN open shutters. It’s working fine when sun rises after 7h but I think it will not next spring when for exmple sun rises at 6h…

I don’t know how to create such flow…

Thanks.

---

<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 11, 2020, 4:13am UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/2 "2020-12-11T04:13:03Z")

</div>

You need 2 flows that respect each other’s time and sunrise:

**If…**  
Time = 7 h  
**And…**  
It’s after sunrise  
It’s a weekday  
It’s not summer  
**Then…**  
Open shutter

**If…**  
It’s sunrise  
**And…**  
Time \> 7 h  
It’s a weekday  
It’s not summer  
**Then…**  
Open shutter

---

<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:** [December 11, 2020, 8:09am UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/3 "2020-12-11T08:09:34Z")

</div>

Another approach is to have three flows. It might seem like it’s more flows but you keep all the conditions in one place.

_Open Shutters At 7 flow_  
**When**  
Time = 7 h  
**Then**  
Start Flow Check Open Shutters

_Open Shutters At Sunrise flow_  
**When**  
Sunrise  
**Then**  
Start Flow Check Open Shutters

_Check Open Shutters Flow_  
**When**  
Flow Starts  
**And**  
It’s after sunrise  
Time \> 7 h  
It’s a weekday  
it’s not summer  
**Then**  
Open shutters.

I’m not saying this is better than @DirkG way, but just giving you options.

---

<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 11, 2020, 10:36am UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/4 "2020-12-11T10:36:34Z")

</div>

@Adrian_Rockall, I love how you built the flows! 👍🏼

---

<div class="post-metadata">

**Author:** ![Christian13](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/christian13/32/27232_2.png) [@Christian13](https://community.homey.app/u/Christian13)\
**Post date:** [December 11, 2020, 1:28pm UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/5 "2020-12-11T13:28:18Z")

</div>

Thanks guys.

My idea was to have only 1 flow, I have already 2 flows for that, just wondering if it was possible to have a flow with 2 “WHEN”.

And also, my shutters are Somfy RTS, so no state possible to know if it’s down or up.

PS : the Adrian’s solution is very “clean”, I like it !  
PS2 : the only one problem is that Homey wil send open order twice to open shutters…

---

<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:** [December 11, 2020, 3:06pm UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/6 "2020-12-11T15:06:05Z")

</div>

I have RTS curtains and blinds and they don’t mind having the commands sent twice. The actual device knows if it’s open or closed so they just ignore the second command.

---

<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 11, 2020, 3:20pm UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/7 "2020-12-11T15:20:04Z")

</div>

> [@Christian13](#):
>
> just wondering if it was possible to have a flow with 2 “WHEN”

[Not possible](https://community.homey.app/search?q=multiple%20triggers).

---

<div class="post-metadata">

**Author:** ![Osorkon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/osorkon/32/43026_2.png) [@Osorkon](https://community.homey.app/u/Osorkon)\
**Post date:** [December 11, 2020, 3:23pm UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/8 "2020-12-11T15:23:26Z")

</div>

Homey and trigger it’s like Highlander  
**„ There Can Be Only 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 11, 2020, 5:50pm UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/9 "2020-12-11T17:50:37Z")

</div>

After running the flow you can disable it and enable again after 2 h, or whatever.  
Therefore you don’t need additional flows.

---

<div class="post-metadata">

**Author:** ![Christian13](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/christian13/32/27232_2.png) [@Christian13](https://community.homey.app/u/Christian13)\
**Post date:** [December 12, 2020, 3:14pm UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/10 "2020-12-12T15:14:39Z")

</div>

Thanks for answers.

Adrian is right, I can send several UP signals, if it’s already opened, no matter (in my case it’s opened twice a day), and disabling flow would not change a lot.

Finally, I keep the solution with 2 flows : one to open at 7 if sunrised already, and one to open when sunrise if time is later than 7.

**Extra question** : can someone give me an example of the ELSE function ? I understand this:  
WHEN something  
AND (conditions OR other conditions) -\> is it right ?  
THEN action  
ELSE alternative action which happens when conditions are not verified ?

---

<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 12, 2020, 3:39pm UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/11 "2020-12-12T15:39:49Z")

</div>

The conditions in the “And…” section must be fulfilled for the action part in the “Then…” section to be executed.  
If there is an “Or” in the “And…” section, then one of the two conditions or groups of conditions must be fulfilled for the action part in the “Then…” section to be executed.  
If no condition or group of conditions is fulfilled in the “And…” section, then the action part in the “Else…” section will be executed.

A simple example is to set a variable. In my case I switch a Yes/No variable to know if the TV is on or not.  
If the energie of the smart plug is more than 25 W then the variable is set to Yes.  
If the energie of the smart plug is less than 25 W then the variable is set to No.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/b/1b654ff8a0a9d1495bd81d920e3746ff1355c550.jpeg)

---

<div class="post-metadata">

**Author:** ![Christian13](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/christian13/32/27232_2.png) [@Christian13](https://community.homey.app/u/Christian13)\
**Post date:** [December 12, 2020, 5:11pm UTC](https://community.homey.app/t/how-to-create-a-flow-trigered-by-event-when-or-event-when/38957/12 "2020-12-12T17:11:07Z")

</div>

Very clear, thank you !
