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?
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:
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.
1 Like