[Android Software Development] brandall:
Creating location based wifi variables

A little tutorial for you:

In the task WIFIOnConVar the first action is to run a separate task called WIFIPREFCON (standing for 'wifi is connected to a preferred network'). To view its actions, click on tasks on the main Tasker page and scroll down to select WIFIPREFCON.

You'll see that it uses the inbuilt 'wifi information' variable (%WIFII) and writes the information it contains to a text file called wifii.txt on the route of your storage card. Make sure you are connected to a wireless network and press the 'test' button. The file will then be created and you can use your file explorer to view its contents.

The only information we require from this text file is the SSID (the public name of your wireless network). In the task WIFIPREFCON, the next step is to extract ONLY that, by 'splitting' (using variable split) the text file before and then after the SSID. This snips out the SSID and writes it to a new variable we create called %WIFIPREF.

So, at this point, when wifi is on and you are connected to a network, the SSID of that network will be contained in the variable %WIFIPREF. Back over in the task of WIFIOnConVar, tasker is setting the variable of %WIFIOC (on & connected) to a value of 2. (1=not connected 2=connected 3=recently disconnected). Our newly created %WIFIPREF variable contains the SSID name of your current connection. The next action is to set a variable that it matches. A variable is only set to a value of 2 (2=connected) >>IF<< the SSID name stored in %WIFIPREF matches the SSID you enter in the IF statement.

For example, my home SSID is SKY12345, so if I was creating the action from scratch +,variable, varible set, name = %WIFIHOME, To 2 , IF %WIFIPREF ~ (matches) SKY12345. You should add in ALL of your frequently used preferred networks in the same way:

name = %WIFIWORK, To 2 (connected), IF %WIFIPREF ~ (matches) Linkys12345.

name = %WIFIPARENTS, To 2 (connected), IF %WIFIPREF ~ (matches) BT-HomeHuB12345.

name = %WIFIGIRLFRIENDSHOUSE, To 2 (connected), IF %WIFIPREF ~ (matches) VIGIN54321.

This way Tasker can always determine where you are if you are connected to a preferred wireless network.

Why is this useful though? There are many profiles kicking around that use GPS or cell tower location so Tasker can estiblish your location. Such profiles can be battery intensive, so avoiding using them would be a bonus whenever possible.

Let's use a scenario:

You are at your girlfriend's house and your last AutoSync used her wireless network. Tasker will know that you are there because %WIFIPREF found her SSID, saw it matched the IF statement in %WIFIGIRLFRIENDSHOUSE and updated the value to 2 (connected). Imagine you are cheating on her and you set up a profile that activates when you are at your girlfriend's house (%WIFIGIRLFRIENDSHOUSE=2). The CheatingProfile reacting to %WIFIGIRLFRIENDSHOUE being updated to a value of 2, diverts all calls from your other girlfriend directly to voicemail, changes the text message recieved profile for just her to silent, copies the text message to a zip folder on the SD card and deletes her message from the inbox, before automatically reply to her saying "stuck in traffic, no hands free, battery low, catch you later princess, love you enternally xxx" Get it?

Another one:

You are at work. When you are at work you use your PC to check your emails and therefore to preserve battery you want to change your AutoSync shedule to 3 hours apart. This can be activated when Tasker sees that %WIFIWORK has been updated to a value of 2. It could also lower you ring tone volume and change it to something more business-like. Really pushing the boundaries it could read your calendar, check when you're next entry label is set to 'busy', read the location information within the entry, check the distance using an HTTP GET command for directions and load up sat Nav for you 5 minutes before the time it's read from google maps you would have to leave the office to get there! Not forgetting to change your AutoSync back to its normally interval. Oh and in your rush to leave, if you forget to turn off wifi, don't worry though, the profile WIFI-AutoDiscon will do it for you in one minutes time ;)

Yes, with Tasker, the possibilities are endless, I just wish it could actually get me a girlfriend, let alone 2! :rolleyes:

I really hope that's helped you understand how having location variables ready to use can assist you further in whatever profiles you choose to create.

Don't forget, that for every new location variable you set in WIFIOnConVar you will need to add the equalivalent entry into the exit task. An example is already in there under %WIFIHOME being set back to a value of 1 (disconnected). And finally, don't forget to change the first GoTO action so it points to the correction action after STOP.

I've just realised, that they also need to be added in to change the values to 1 in the profile WIFI-AutoDiscon - Oops! I'll do that in version 2.

Credit peswe for making me realise this!

Any questions, let me know...