# Error "Network request failed" during test of a flow while using a delay function

**URL:** https://community.homey.app/t/error-network-request-failed-during-test-of-a-flow-while-using-a-delay-function/93503
**Category:** Questions & Help
**Tags:** homey-pro, advancedflow
**Created:** [November 2, 2023, 4:38pm UTC](https://community.homey.app/t/error-network-request-failed-during-test-of-a-flow-while-using-a-delay-function/93503 "2023-11-02T16:38:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Wideman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wideman/32/81907_2.png) [@Wideman](https://community.homey.app/u/Wideman)
#### Post date: [November 2, 2023, 4:38pm UTC](https://community.homey.app/t/error-network-request-failed-during-test-of-a-flow-while-using-a-delay-function/93503/1 "2023-11-02T16:38:02Z")

</div>

Hi!

I’m trying to create a flow with a variable delay that I will use to manage the engine heater for our car.  
Depending on the outdoor temperature, I would like the engine heater to run for 60, 90 or 120 minutes and then turn off again.  
However, when I try to create and test a simple flow for this I end up with the delay card failing with “Network request failed” and I cannot really figure out why this happens. I have tried to search in the Homey community and have performed the usual trouble shooting restart of my Homey system but have so far not been able to figure out the cause of this problem.

**Below shows an example of a test I ran with a delay of 60 seconds:**

 ![delay1](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/c/7cb0f79b4045d66c72e4c3ed573b931d47d58aeb.jpeg)

If I however set a short 10 second delay via my variable all three tests scenarios run successfully.  
Any help how to resolve this would be greatly appreciated.

---

<div class="post-metadata">

### Author: ![Wideman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wideman/32/81907_2.png) [@Wideman](https://community.homey.app/u/Wideman)
#### Post date: [November 2, 2023, 4:38pm UTC](https://community.homey.app/t/error-network-request-failed-during-test-of-a-flow-while-using-a-delay-function/93503/2 "2023-11-02T16:38:54Z")

</div>

The variable I have defined for this test scenario:

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

---

<div class="post-metadata">

### Author: ![Wideman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wideman/32/81907_2.png) [@Wideman](https://community.homey.app/u/Wideman)
#### Post date: [November 2, 2023, 4:39pm UTC](https://community.homey.app/t/error-network-request-failed-during-test-of-a-flow-while-using-a-delay-function/93503/3 "2023-11-02T16:39:34Z")

</div>

The script for the first test scenario:

 ![delay7](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/1/d12b4b8e272c5987eedc40b396acf535f874f2cb.jpeg)

---

<div class="post-metadata">

### Author: ![Wideman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wideman/32/81907_2.png) [@Wideman](https://community.homey.app/u/Wideman)
#### Post date: [November 2, 2023, 4:41pm UTC](https://community.homey.app/t/error-network-request-failed-during-test-of-a-flow-while-using-a-delay-function/93503/4 "2023-11-02T16:41:43Z")

</div>

The script for the second test scenario:

 ![delay6](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/d/ad3d203c625527a43eb3da38bf2fa1e0574c0941.jpeg)

---

<div class="post-metadata">

### Author: ![Wideman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wideman/32/81907_2.png) [@Wideman](https://community.homey.app/u/Wideman)
#### Post date: [November 2, 2023, 4:42pm UTC](https://community.homey.app/t/error-network-request-failed-during-test-of-a-flow-while-using-a-delay-function/93503/5 "2023-11-02T16:42:53Z")

</div>

The results for test scenario two:

 ![delay2](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/b/2b3fded96111812adcc3ff2a6a98d5e18fe3ddcf.jpeg)

---

<div class="post-metadata">

### Author: ![Wideman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wideman/32/81907_2.png) [@Wideman](https://community.homey.app/u/Wideman)
#### Post date: [November 2, 2023, 4:43pm UTC](https://community.homey.app/t/error-network-request-failed-during-test-of-a-flow-while-using-a-delay-function/93503/6 "2023-11-02T16:43:25Z")

</div>

The results for test scenario three:

 ![delay3](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/5/c569387d1432eb8ca708a3c20bcc87d390e939fc.jpeg)

---

<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: [November 2, 2023, 9:11pm UTC](https://community.homey.app/t/error-network-request-failed-during-test-of-a-flow-while-using-a-delay-function/93503/7 "2023-11-02T21:11:26Z")

</div>

Don’t use the yes/no option, just “Run code with argument” like scenario 2.  
Otherwise you’ll need to use this when you use `result true;`:

 ![Screenshot from 2023-11-02 22-08-22](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/4/54b67ba2c7532e49eb1ca0582c31833cd389c4a1.png)

**The only (odd) problem here is using the “Test run”**: I also get the Network request failed error after 30s.  
30s. is the default web time-out, probably to prevent endless running cards.  
But, that’s the only problem in this particular case, while the flow runs fine in normal use 🥳  
When I start it in normal mode using the “Start this flow” menu entry

 ![Screenshot from 2023-11-02 22-03-14](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/a/1ae67db996b8a6e9f329ae6c0e4c1c8c02da005f.png)

It shows the expected Timeline results:  
 ![Screenshot from 2023-11-02 22-14-17](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/6/e6a3db4d4f8fa02c0c1f4d0557923e4607d133b1.png)

I used the same wait code as you did.
