Wifi Auto Off after disconnected for 2 min?

2482 views
Skip to first unread message

Andrew Drumm

unread,
Mar 23, 2011, 11:12:50 AM3/23/11
to Tasker
I have an app called auto wifi on/off that I just use just to turn off
my wifi after it has been disconnected for about 2 minutes so when I
leave my home I don't have my phone searching for wifi signals and
waisting battery. I'm sure there is a way to do this with tasker, I
just can't figure out how to do it. As a plus I'd like to use it so
that my wifi turns off only when it has been disconnected for a solid
two minutes. That way when I go to get my mail and my wifi only loses
connection for a short period of time, the tasker auto wifi off will
not execute so I can go back inside and not have to turn wifi back on.
Any help would be greatly appreciated.

TS

unread,
Mar 23, 2011, 8:38:05 PM3/23/11
to Tasker
Hi,

You could set up a profile that is active if Wifi is not connected
(context: state -> wifi connected, set invert) and create a task which
does the following:

1. wait 2min
2. disable wifi if %WIFII is false

I am however not sure how to use the built-in variable %WIFII
correctly, you would have to test this.

Maybe you can even avoid the if-condition and try it the simple way...

Regards

Andrew Drumm

unread,
Mar 23, 2011, 11:18:53 PM3/23/11
to Tasker
I tried the above before with no if condition and whenever I connected
to a wifi network tasker would turn off wifi immediately. I'll give
this script a try with the if condition and see if it works. Thanks
for your help.

Sen

unread,
Mar 24, 2011, 3:30:24 AM3/24/11
to Tasker
WiFi Info
%WIFII
When connected to an Access Point (AP), shows human-readable data
about the AP. When not connected, show details of the most recent Wifi
scan results for nearby APs.

I think we need the other way to read the wifi status

Sen

unread,
Mar 23, 2011, 11:45:29 PM3/23/11
to Tasker
WiFi Info
%WIFII
When connected to an Access Point (AP), shows human-readable data
about the AP. When not connected, show details of the most recent Wifi
scan results for nearby APs.

I think we need the other way to read the wifi status

On 3月24日, 上午8時38分, TS <tim.ster...@gmail.com> wrote:

Sen

unread,
Mar 23, 2011, 11:47:02 PM3/23/11
to Tasker

WiFi Info
%WIFII
When connected to an Access Point (AP), shows human-readable data
about the AP. When not connected, show details of the most recent Wifi
scan results for nearby APs.

I think we need the other way to read the wifi status

On 3月24日, 上午8時38分, TS <tim.ster...@gmail.com> wrote:
> > Any help would be greatly appreciated.- 隱藏被引用文字 -
>
> - 顯示被引用文字 -

TS

unread,
Mar 24, 2011, 10:09:07 AM3/24/11
to Tasker
@Andrew:

Did you set the "invert" option in the profile context?
And maybe you need to set "keep device awake" in the task settings...

@Sen:
You're right about the %WIFII variable. I don't know how Tasker
handles for example an if-condition "%WIFII = 1".
Maybe Pent can help out there...

regards

bdanders

unread,
Mar 24, 2011, 11:19:34 AM3/24/11
to Tasker
I just set up just such a profile and it works like a charm. I
actually use two profiles, one detects when wifi is on, but not
connected and sets a variable %WIFIONDISCONNECTED to 1. The other
reacts to this variable and initiates a debounce sequence to make sure
that I'm not killing wifi during momentary losses of communication
like taking out the trash. I like to use a shorter timer in
conjuction with a counter because it kills the task sooner if the
conditions are no longer met.

You can ignore most of the alerts (they are there for debugging, hence
the "NEVERONE~1") but if you remove them, be sure to update the "GoTo"
numbers accordingly.

Profile: Wifi On/Disconnected (113)
State: Not Wifi Connected
State: Variable Value
Enter: Anon (114)
A1: Variable Set [ Name:%WIFIONDISCONNECTED To:1 Do Maths:Off
Append:Off ]

Exit: Anon (100)
A1: Variable Clear [ Name:%WIFIONDISCONNECTED ]

Profile: Wifi Off Debounce (115)
Event: Variable Set
State: Variable Value
Enter: Wifi Auto Off (112)
A1: Popup [ Title: Text:%WIFI
%WIFII Time:5 Centre Text:Off Text Size:18 Background Image: ] If
[ %NEVERONE ~ 1 ]
A2: Variable Set [ Name:%WIFIDEBOUNCE To:1 Do Maths:Off Append:Off ]
A3: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ]
A4: Variable Add [ Name:%COUNTER1 Value:1 Wrap Around:0 ]
A5: Flash [ Text:Count: %COUNTER1 Long:Off ] If [ %NEVERONE ~ 1 ]
A6: Goto Action [ Number:10 ] If [ %WIFIONDISCONNECTED != 1 ]
A7: Goto Action [ Number:9 ] If [ %COUNTER1 > 12 ]
A8: Goto Action [ Number:3 ]
A9: WiFi [ Set:Off ] If [ %WIFIONDISCONNECTED ~ 1 ]
A10: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ]
A11: Variable Clear [ Name:%WIFIDEBOUNCE ]
A12: Variable Clear [ Name:%WIFIONDISCONNECTED ] If [ %WIFI ~ off ]
A13: Variable Clear [ Name:%COUNTER1 ]
> > > - 顯示被引用文字 -- Hide quoted text -
>
> - Show quoted text -

bdanders

unread,
May 16, 2011, 11:10:20 PM5/16/11
to Tasker
I've gotten a couple of emails asking about this profile so I thought
I would add a couple more details to clear things up.

Profile: Wifi On/Disconnected (113)
State: Not Wifi Connected
State: Variable Value %WIFI matches 'on'
Enter: Anon (114)
A1: Variable Set [ Name:%WIFIONDISCONNECTED To:1 Do Maths:Off
Append:Off ]

Exit: Anon (100)
A1: Variable Clear [ Name:%WIFIONDISCONNECTED ]

Profile: Wifi Off Debounce (115)
Event: Variable Set %WIFIONDISCONNECTED = 1
State: Variable Value %WIFIDEBOUNCE != 1
Enter: Wifi Auto Off (112)
A1: Popup [ Title: Text:%WIFI
%WIFII Time:5 Centre Text:Off Text Size:18 Background Image: ] If
[ %NEVERONE ~ 1 ]
A2: Variable Set [ Name:%WIFIDEBOUNCE To:1 Do Maths:Off
Append:Off ]
A3: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ]
A4: Variable Add [ Name:%COUNTER1 Value:1 Wrap Around:0 ]
A5: Flash [ Text:Count: %COUNTER1 Long:Off ] If [ %NEVERONE ~
1 ]
A6: Goto Action [ Number:10 ] If [ %WIFIONDISCONNECTED != 1 ]
A7: Goto Action [ Number:9 ] If [ %COUNTER1 > 12 ]
A8: Goto Action [ Number:3 ]
A9: WiFi [ Set:Off ] If [ %WIFIONDISCONNECTED ~ 1 ]
A10: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ]
A11: Variable Clear [ Name:%WIFIDEBOUNCE ]
A12: Variable Clear [ Name:%WIFIONDISCONNECTED ] If [ %WIFI ~
off ]
A13: Variable Clear [ Name:%COUNTER1 ]

goose

unread,
May 16, 2011, 7:23:38 PM5/16/11
to Tasker
Bryce, As I'm entering the profile you created below, I don't know
what to enter for the State: Variable Value you mention below (Is it
%WIFIONDISCONNECTED ~ 1)?:

Profile: Wifi Off Debounce (115)
Event: Variable Set
State: Variable Value



goose

unread,
May 16, 2011, 7:27:09 PM5/16/11
to Tasker
Bryce, As I'm entering the profile you created below, I don't know
what to enter for the State: Variable Value you mention below (Is it
%WIFIONDISCONNECTED ~ 1)?:

Profile: Wifi Off Debounce (115)
Event: Variable Set
State: Variable Value

On Mar 24, 10:19 am, bdanders <the.bryce.ander...@gmail.com> wrote:

goose

unread,
May 16, 2011, 7:30:52 PM5/16/11
to Tasker
Bryce, As I'm entering the profile you created below, I don't know
what to enter for the State: Variable Value you mention below (Is it
%WIFIONDISCONNECTED ~ 1)?:

Profile: Wifi Off Debounce (115)
Event: Variable Set
State: Variable Value

On Mar 24, 10:19 am, bdanders <the.bryce.ander...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages