Page 1 of 1

Delay Action

Posted: 06 Jul 2013 15:08
by ahmadmll
Hi Friends!
I want to create flow that delay an action

for example:

when wifi connected after 30min wifi disconnect.

can u help me????????????

Re: Delay Action

Posted: 06 Jul 2013 18:01
by Martin
Hi,

There are multiple options:

1) Most simple solution but potentially battery draining:
Add an action Sleep: 30m before executing action Set WiFi State: Off.
This solution might not be optimal since it will keep the device awake while action Sleep is executing. This might not be a problem if you are using the device in the 30 minute interval.

2) create a disabled flow named Turn Wifi Off delayed with a trigger Periodic Timer: 30m and actions Set WiFi State: Off and Set Flow State: Disable Turn Wifi Off delayed.
Use an action Set Flow State: Enable Turn Wifi Off delayed in your main flow to activate the helper flow.
The helper flow will initially wait for 30 minutes (without keeping the device awake) and then turn WiFi off and disable itself again.

3) Solution using a script and a variable:
Create an enabled flow named Turn Wifi Off at time with a trigger Global Variable Date/Time: global_trigger_date and action Set WiFi State: Off.
Use an action Script: global_trigger_date=getDate()+30*60*1000 in your main flow. This will store the current time + 30 minutes in the global variable.
The trigger Global Variable Date/Time will be executed when the time stored in the variable global_trigger_date is reached.

Regards,
Martin