Page 1 of 1

Sleep vs Wait

Posted: 07 Feb 2017 09:18
by julian.colombo
Hi,

The 'sleep' action pauses the entire flow, but I wish to 'wait'! Is there such an action already avaliable? If not, is it possible to implement this feature?

Thanks.

Julian

Re: Sleep vs Wait

Posted: 07 Feb 2017 09:38
by fagci
If interval so huge, you can set interval trigger and wait for needeed date difference

Re: Sleep vs Wait

Posted: 07 Feb 2017 09:42
by julian.colombo
Trigger will not help!

Re: Sleep vs Wait

Posted: 13 Jun 2019 21:15
by Pepy
I know this thread is pretty old, but you should be able to just use a sleep() function in the Control UI action. Another way would be to create another flow with a Sleep action and then use the Execute Flows action with the Wait for called flows to finish option checked.

Re: Sleep vs Wait

Posted: 15 Jun 2019 16:33
by Desmanto
The wait mentioned here probably refer a condition that wait for certain value to become true, before continuing. In that case, the better way is to use the trigger counterpart of the condititon. Or else, the solution is to use looped condition check over interval sleep. So maybe the flow run, check if condition fulfilled. If not, go to sleep 5 seconds, loop back to the condition, check again. This will make the flow run forever, creating a long wakelock and killing the battery.

Re: Sleep vs Wait

Posted: 17 Jun 2019 04:44
by Pepy
Desmanto wrote:
15 Jun 2019 16:33
In that case, the better way is to use the trigger counterpart of the condititon.
That's true, but unless it were to be a setting like auto rotate, it would require a global variable. I guess another way to do this is to just separate it into another flow and use action Execute Flows once the wait is over.
Desmanto wrote:
15 Jun 2019 16:33
Or else, the solution is to use looped condition check over interval sleep. So maybe the flow run, check if condition fulfilled. If not, go to sleep 5 seconds, loop back to the condition, check again. This will make the flow run forever, creating a long wakelock and killing the battery.
I did use this method to continuously check every few seconds if the screen was on AND the keyguard was unlocked but now, I just use a Keyguard Unlocked condition because as you said, it can drain the battery. Whenever I use this loop method, I would create a variable to count down from to limit the amount of "retries".

Re: Sleep vs Wait

Posted: 17 Jun 2019 17:06
by Desmanto
Auto rotate state can be detected using Trigger System Setting Changed : [System] accelerometer_rotation : 0 >>> 1
Other state probably can be detected using the same trigger, but with different value.

If the loop wait-check is short, less than 1 minute, then you can loop several times and use the counter to limit number of check, so it doesn't loop forever. But if the wait is longer than 1 minute, better utilize global variable datetime (glovardt) trigger to implement the loop. Add the glovardt everytime the condition is false.

Re: Sleep vs Wait

Posted: 23 Jun 2019 05:51
by Pepy
Desmanto wrote:
17 Jun 2019 17:06
Auto rotate state can be detected using Trigger System Setting Changed : [System] accelerometer_rotation : 0 >>> 1
Other state probably can be detected using the same trigger, but with different value.
If you mean as a trigger, then yeah, that should do the trick. I was thinking of a check within a flow; my bad there.
Desmanto wrote:
17 Jun 2019 17:06
If the loop wait-check is short, less than 1 minute, then you can loop several times and use the counter to limit number of check, so it doesn't loop forever. But if the wait is longer than 1 minute, better utilize global variable datetime (glovardt) trigger to implement the loop. Add the glovardt everytime the condition is false.
I like to use a Expression condition to do this instead as you can manipulate the value however you want (eg. resetting it back to default). if the wait was longer though, I think the Global Variable trigger would be better suited for the job if he's waiting for a specific change in value.