# Wait until (and) flow

**URL:** <https://community.homey.app/t/wait-until-and-flow/57624>\
**Category:** Questions & Help\
**Created:** [January 1, 2022, 8:26pm UTC](https://community.homey.app/t/wait-until-and-flow/57624 "2022-01-01T20:26:20Z")\
**Posts on this page:** 8\
**Page:** 1

<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:** [January 1, 2022, 8:26pm UTC](https://community.homey.app/t/wait-until-and-flow/57624/1 "2022-01-01T20:26:20Z")

</div>

Guys I want to create a flow that is triggered when my presense is set to home. However i dont want the flow to act untill the door contact is openend. I noticed that when the trigger is announced after a certain time if the "and"criteria is not met it just cancel that flow execution. Is there anyway i can make the flow wait in the “and” section till the criteria becomes “True”? Btw i cant use delay because i cant predict how long it would take to reach the door.  
Kind regards.

---

<div class="post-metadata">

**Author:** ![Dijker](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dijker](https://community.homey.app/u/Dijker)\
**Post date:** [January 1, 2022, 8:53pm UTC](https://community.homey.app/t/wait-until-and-flow/57624/2 "2022-01-01T20:53:39Z")

</div>

For a Homey Pro?

Flow 1  
When I come home  
Then Start timer for 5 minutes

Flow 2  
When door opens  
And timer is running  
Then do action and stop timer

---

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [January 1, 2022, 9:14pm UTC](https://community.homey.app/t/wait-until-and-flow/57624/3 "2022-01-01T21:14:30Z")

</div>

> [@BIRDY](#):
>
> that is triggered when my presense is set to home. However i dont want the flow to act untill the door contact is openend.

From your description I conclude that “presence is home” will always occur before the “door contact is opened”.  
Is that always true? (Depending on the way you do it it can have delays)

If it is not… it will be a bit more complex than @dijkers solution

You might need to add some extra flows for that case:

Flow 3  
When door opens  
Then Start timer for 1 minute (or more if presence detection takes longer)

Flow 4  
When I come home  
And timer is running  
Then do action and stop timer

---

<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:** [January 3, 2022, 7:54pm UTC](https://community.homey.app/t/wait-until-and-flow/57624/4 "2022-01-03T19:54:00Z")

</div>

That is the issue i cant predict how long it would take to reach the door. Another issue is that you cant use a timer in the Flow “AND” section.

Any other idea?

---

<div class="post-metadata">

**Author:** ![Dijker](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dijker](https://community.homey.app/u/Dijker)\
**Post date:** [January 3, 2022, 8:00pm UTC](https://community.homey.app/t/wait-until-and-flow/57624/5 "2022-01-03T20:00:33Z")

</div>

> [@BIRDY](#):
>
> That is the issue i cant predict how long it would take to reach the door.

What is the maximum you would accept as time?

---

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [January 3, 2022, 10:05pm UTC](https://community.homey.app/t/wait-until-and-flow/57624/6 "2022-01-03T22:05:05Z")

</div>

> [@BIRDY](#):
>
> That is the issue i cant predict how long it would take to reach the door.

When your presence is detected earlier then you open the door @Dijker solution wil be working.  
You can even extend the timeframe

---

<div class="post-metadata">

**Author:** ![aste](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/aste/32/9729_2.png) [@aste](https://community.homey.app/u/aste)\
**Post date:** [February 17, 2022, 3:44pm UTC](https://community.homey.app/t/wait-until-and-flow/57624/7 "2022-02-17T15:44:08Z")

</div>

I’m using logics for this.

You need a Boolean called something like SensorTriggerdSinceDisarm

Flow 1  
When: Someone came home  
Then: Set SensorTriggerdSinceDisarm to No  
Then: Enable Flow 2

Flow 2  
When: Any contact sensor trigger  
Then: Set SensorTriggerdSinceDisarm to Yes

Flow 3  
When: Logic SensorTriggerdSinceDisarm changed  
And: Logic SensorTriggerdSinceDisarm is Yes  
Then: Do your magic  
Then: Disable Flow 2

So when you get home, flow 2 will wait for you to open the door. Then Flow 3 will kick in.  
Enabling and disabling flow 2 is to save resources in Homey. Otherwise it will trigger every time a contact sensor triggers. It may not be an issue in this specific case, but if you have motion sensors doing this in a busy house with many flows it starts to make sense.

Good luck!

---

<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:** [February 17, 2022, 4:13pm UTC](https://community.homey.app/t/wait-until-and-flow/57624/8 "2022-02-17T16:13:53Z")

</div>

> [@BIRDY](#):
>
> Another issue is that you cant use a timer in the Flow “AND” section.

Depends on the timer app you use?

> ![Screenshot from 2022-02-17 17-08-55](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/3/e3cbcafadf6420e1053190fa52e3ee779b81a77c.png)

.

> [@BIRDY](#):
>
> That is the issue i cant predict how long it would take to reach the door.

Set the timer to 120mins, to 4hrs or even to 24hrs. That doesn’t matter.  
As long as

- the timer still runs after you came home and open the door for the 1st time at some point
- you (read: the flow) should STOP the timer when the door opens
