# Homeyscript help: delay less the 1 second

**URL:** <https://community.homey.app/t/homeyscript-help-delay-less-the-1-second/36613>\
**Category:** Developers\
**Created:** [October 27, 2020, 9:04pm UTC](https://community.homey.app/t/homeyscript-help-delay-less-the-1-second/36613 "2020-10-27T21:04:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Starren](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tom_starren/32/3697_2.png) [@Tom\_Starren](https://community.homey.app/u/Tom_Starren)\
**Post date:** [October 27, 2020, 9:04pm UTC](https://community.homey.app/t/homeyscript-help-delay-less-the-1-second/36613/1 "2020-10-27T21:04:06Z")

</div>

I hope someone can help me with the following. I have a flow and the default shortest delay of 1 second is to long. Is there an easy way I can wrap this in a homeyscript?

---

<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:** [October 28, 2020, 6:42am UTC](https://community.homey.app/t/homeyscript-help-delay-less-the-1-second/36613/2 "2020-10-28T06:42:44Z")

</div>

Because flow actions are executed concurrently you cannot insert a Homeyscript action and let the rest of the actions wait for it to finish.

It might be possible to work around that by splitting your flows. I assume you have a flow like this:

- WHEN something
- THEN
  - perform action A
  - perform action B after 500ms (half a second)

You could rewrite it to this:

Flow 1:

- WHEN something
- THEN
  - perform action A
  - start Flow 2

Flow 2:

- WHEN this flow is started
- AND run “delay script”
- THEN perform action B

The delay script is a Homeyscript that looks like this:

```auto
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));

await delay(500);
return true;

```

However, such a delay will only be approximate and will depend on how busy your Homey is.
