# Advanced flow - Delay with variable option

**URL:** <https://community.homey.app/t/advanced-flow-delay-with-variable-option/65764>\
**Category:** Ideas & Suggestions\
**Tags:** advancedflow\
**Created:** [July 9, 2022, 6:17pm UTC](https://community.homey.app/t/advanced-flow-delay-with-variable-option/65764 "2022-07-09T18:17:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Littlebigshorty](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/littlebigshorty/32/34278_2.png) [@Littlebigshorty](https://community.homey.app/u/Littlebigshorty)\
**Post date:** [July 9, 2022, 6:17pm UTC](https://community.homey.app/t/advanced-flow-delay-with-variable-option/65764/1 "2022-07-09T18:17:01Z")

</div>

Hi,

I’m using delay in a flow where defining a variable to set the delay length in the beginning before doing (same) stuff for all delay length and ending with one delay and action would make more sense then having to make a lot more stuff happening in the flow.

Is this something that could be implemented?

-Ståle

---

<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:** [July 9, 2022, 6:59pm UTC](https://community.homey.app/t/advanced-flow-delay-with-variable-option/65764/2 "2022-07-09T18:59:14Z")

</div>

I’ve read your post several times, but I don’t get it. Can you add a flow screenshot maybe?

---

<div class="post-metadata">

**Author:** ![Littlebigshorty](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/littlebigshorty/32/34278_2.png) [@Littlebigshorty](https://community.homey.app/u/Littlebigshorty)\
**Post date:** [July 9, 2022, 8:57pm UTC](https://community.homey.app/t/advanced-flow-delay-with-variable-option/65764/3 "2022-07-09T20:57:03Z")

</div>

Sure! I just added a few of the triggers for this flow as an example. i have 7 “triggers” and 3 delay settings at the moment, but adding more later. If it was possible to use the number variable set in the logic at the start directly into the delay, it would be more efficient and easier then looping into every number to check if its the correct delay time and use one delay for each.

 ![example](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/1/517cbc5a7835b4883c4d1e5182358d6a53fafa7e.jpeg)

-Ståle

---

<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:** [July 9, 2022, 9:18pm UTC](https://community.homey.app/t/advanced-flow-delay-with-variable-option/65764/4 "2022-07-09T21:18:50Z")

</div>

Guess this ie easier:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/f/cf4ed4ef8c01d4c2183d7ef90161f15195656223.png)

The Code

```auto
// Wait Seconds
// console.log(args[0]);
await wait( args[0]*1000 ); // Seconds to ms,
return true;

```

---

<div class="post-metadata">

**Author:** ![Littlebigshorty](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/littlebigshorty/32/34278_2.png) [@Littlebigshorty](https://community.homey.app/u/Littlebigshorty)\
**Post date:** [July 10, 2022, 6:30am UTC](https://community.homey.app/t/advanced-flow-delay-with-variable-option/65764/5 "2022-07-10T06:30:03Z")

</div>

Ah! Thank you! Didn’t think of scripts! I’ll use this insted!

-Ståle
