Auto Wifi on/off and Detection Connection/No Connection

1,437 views
Skip to first unread message

Joe L

unread,
Jan 17, 2012, 6:03:37 PM1/17/12
to Tasker
I'm trying to figure out how to detect if WiFi is connected or even on/
off. When Wifi is enabled my phone will auto-detect and auto-connect
to any open wifi it finds (i.e. Free Wifi Hotspots).

Short Version:
If I detect Free Wifi then connect to it. Otherwise keep wifi off.

Long Version:
I need to periodically turn on Wifi, confirm if connected to wifi, and
if not turn off wifi, then recheck a few minutes later. If connected
to wifi then then leave wifi on.

I really have tried but there doesn't SEEM to be an easy way to do
this because the profile and task options available aren't sufficient.
For example setting a new Profile there is the option to detect WIFI
Connection/No Connection but NOT an option to detect WIFI ON/OFF. When
creating a task there's no action for detect Wifi Connection/No
Connection like there is with setting the Profile but there is the
Wifi On/Off.

I've scoured google with no success for existing profiles. Everyone
else is turning on/off wife based on location.
For my needs location is irrelevant.

I'm still learning Tasker and how variables work. Too bad its not in
VB cause I could nail it easily.

Any help is appreciated.

Pent

unread,
Jan 18, 2012, 4:17:09 AM1/18/12
to Tasker
> Long Version:
> I need to periodically turn on Wifi, confirm if connected to wifi, and
> if not turn off wifi, then recheck a few minutes later. If connected
> to wifi then then leave wifi on.

This first profile puts the current wifi connection state in a
variable.

Profile: WifiDetector
State: Wifi Connected
Enter Task: Variable Set: %CONNECTED, 1
Exit Task: Variable Clear, %CONNECTED

This one tries to connect every 10 minutes:

Profile: WifiChecker
Time: Repeat 10 Minutes
Stop If Is Set %CONNECTED
Wifi On
Wait 30 Seconds
Wifi Off If Isn't Set %CONNECTED

>
> I really have tried but there doesn't SEEM to be an easy way to do
> this because the profile and task options available aren't sufficient.
> For example setting a new Profile there is the option to detect WIFI
> Connection/No Connection but NOT an option to detect WIFI ON/OFF.

You can make a state Variable Value and say '%WIFI Matches on' for the
condition.

Pent

Joe L

unread,
Jan 18, 2012, 5:11:19 AM1/18/12
to Tasker
Thanks. I Finally figured it out though its not as simple as yours. So
I'll try it that way.

But I did run into one snag. It turns out that my phone will connect
to the ATT Hotspots automatically but not a random unprotected Wifi
signal.
I have to manually go into WiFi Settings, click on the open Wifi
connection, and click connect. Once it's remembered my phone will then
auto connect to it.

Anyway to make it auto connect to an open Wifi connection if found and
not remembered?

Pent

unread,
Jan 18, 2012, 5:23:52 AM1/18/12
to Tasker
> Anyway to make it auto connect to an open Wifi connection if found and
> not remembered?

Sorry, no.

In my Advanced wifi settings I have 'Notify me when an open network is
available'. Does that not help ?

Pent

Joe L

unread,
Jan 18, 2012, 5:34:19 AM1/18/12
to Tasker
After reviewing your setup I'm finally understanding more about
Tasker. I knew about Exit tasks but for some darn reason I had
forgotten about them. That would have saved a great amount of time if
I had considered that. I just have to remember that an exit task
occurs when the state no longer applies.

I can read your setup as: If Wifi is connected then CONNECTED = TRUE.
If WIFI is not connected then CONNECTED = FALSE.
Every 10 minutes, IF CONNECTED = TRUE then EXIT. ELSE Wifi On. Wait 30
seconds. If CONNECTED = FALSE then Wifi off.

This will help me better utilize the Exit Task function and now I
understand setting and checking variables status.

Thanks much Pent!

> You can make a state Variable Value and say '%WIFI Matches on' for the
> condition.

I did figure out that one problem is that "On" and "Off" are case
sensitive. Previously I was using "ON" and it wouldn't recognize the
condition.

Joe L

unread,
Jan 18, 2012, 5:38:44 AM1/18/12
to Tasker

> In my Advanced wifi settings I have 'Notify me when an open network is
> available'. Does that not help ?

I suppose that would be the best work around. Where can I find this
setting?

Pent

unread,
Jan 18, 2012, 6:18:46 AM1/18/12
to Tasker
On my vanilla ICS, it's in Menu / System Settings / Wifi Settings /
Menu / Advanced.

Pent

Joe L

unread,
Jan 18, 2012, 6:24:22 AM1/18/12
to Tasker

> On my vanilla ICS, it's in Menu / System Settings / Wifi Settings /
> Menu / Advanced.

Sad day for me. My GS2 is still on 2.3. But will def look into it when
we get ICS. Thanks for all your help. I was able to delete like 4
useless profiles once I made proper use of the Exit Task function. =)

BossMan

unread,
Jan 18, 2012, 6:57:00 AM1/18/12
to tas...@googlegroups.com


On Wednesday, January 18, 2012 12:24:22 PM UTC+1, Joe L wrote:

> On my vanilla ICS, it's in Menu / System Settings / Wifi Settings /
> Menu / Advanced.

Sad day for me. My GS2 is still on 2.3. But will def look into it when
we get ICS. 

This setting has been available in Android for years and according to some quick google search it should be available on Galaxy S II as well.. http://my.safaribooksonline.com/book/-/9781449321291/vdot-advanced/351

BR,
A.
Message has been deleted

Joe L

unread,
Jan 18, 2012, 7:08:09 AM1/18/12
to Tasker
> This setting has been available in Android for years and according to some
> quick google search it should be available on Galaxy S II as well..http://my.safaribooksonline.com/book/-/9781449321291/vdot-advanced/351

Yeah I realized there is the setting built into androids wifi
settings.
I thought he meant there was a Tasker function for it. I
misunderstood.
But it would be nice if Tasker had that as well in order to setup a
custom notification.

But of course Auto connecting to an Open Wifi without manual
connection would be better. I just tried Wefi PRO Beta but it
didn't work. Oh well.

BossMan

unread,
Jan 18, 2012, 7:47:21 AM1/18/12
to tas...@googlegroups.com
But of course Auto connecting to an Open Wifi without manual
connection would be better. I just tried Wefi PRO Beta but it
didn't work. Oh well.
 
It's an Android limitation (made on purpose, I believe) - you can only autoconnect to known access points. This is to avoid situation your phone connects to some rogue network that can potentially do more harm than good.
Apps like Wefi bypass this by exposing to system only a virtual access point created by themselves (which is "known" thus - allow autoconnect) and handling connection to real access points on their own (at least that's how it worked in Symbian - I haven't tried apps like this in Android but I believe it's more-less similar).

BR,
A.
Reply all
Reply to author
Forward
0 new messages