• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

AfroSheen Profile

AfroSheen

Newbie
Jan 19, 2012
19
3
NC
First, Kudos to all who have contributed to this thread!

I stumbled onto Tasker a couple weeks ago, then I found this thread and have had it up on my screen reading at my leisure for most of 2 weeks (2 years worth of postings!). When I was about 2 pages into it, I purchased Tasker and have been fooling around with it during the time I was reading this thread. Now that I finally finished reading, I just had to join the forum and post what I have been doing with it.

I, like most people, want a lot of my contexts to be location based because I change several settings depending on whether I am in a "familiar" location or not, and also wish to preserve battery life as much as possible. I also like to impress my friends when my phone talks and tells me what it is up to!

I noticed (maybe I'm wrong) that when I used multiple "WIFI Near" contexts, it seemed to be polling the WIFI way too often (for each context?), so here is how I determine locations in 3 easy steps:

1)
I called my first context "WIFI Pinger" and it is simply "WIFI Near Eternity" and all it does is Say "OMG I am here!". (I don't know if there IS a WIFI SSID called "Eternity", but if I ever come across it, I will know!) This context simply toggles WIFI on periodically to check for any signals it can find.

2)
The second one is called "WIFI is On" (%WIFI eq on) which gets triggered by the WIFI Pinger.) This runs a task I call "Wifi Check" that simply captures the WIFI Info (%WIFII) into a global variable "%wifiInfo" (IF it is at least 20 characters long and contains "SCAN" in the text.) and has an Exit Task called "Where Am I" that basically determines if any familiar SSIDs are in this text (more on this later).

3)
The third one does a "WIFI Connected *,*,*" (to anywhere) which calls a task "Log In" which cleans up and stores the current WIFI Info (%WIFII) which contains the connected SSID, speed, channel, etc.) into another global variable (%wifiConnected) along with a date and time stamp, and has an Exit Task called "Log Out" that modifies this global variable by simply putting "!!!" in front of the SSID and the current (logout) time at the end.

Now, for the Task called "Where Am I".
This is for determining if I am at a "familiar place" where I want to relax my security (disable my keyguard, etc.) and whatever other settings I want to set in this case. I wanted to use a single integer variable and just set bits for each location, but the best I could do was to create another global variable called "%FAMILIAR" that is a comma delimited string, initialized as "0,0,0,0,0". I change the first number to "1" if I am at home, the second to "2" if at work, the third to "3" if in the car (car bluetooth connected), and the fourth to "4" if I am at a friends/family/any other generic "familiar place", usually based on identified WIFI SSIDs (they are everywhere!) or connected BlueTooth IDs. (The fifth spot is currently unused)

Now I created these profile contexts to track where I am:

Familiar Place
...%FAMILIAR Is Set + %FAMILIAR neq "0,0,0,0,0"
........->Guard Down
.............Relax security,
.............Say "There's no place like home" IF %FAMILIAR ~ "*1*"
.............Say "Let's get to work" IF %FAMILIAR ~ "*2*"
.............Say "Going for a drive" IF %FAMILIAR ~ "*3*"
.............Say "I recognize this place" IF %FAMILIAR ~ "*4*"
........<-Guard Up
.............Say "I feel threatened!"
.............Re-enable security

At Home
....%wifiInfo ~ *[homeSSID]* + %FAMILIAR ~ "*1*"
..........-> Enter Home
................[whatever]
...........<- Leave Home
................Say "Are we going somewhere?"

At Work
....%wifiInfo ~ *[workSSID]* + %FAMILIAR ~ "*2*"
...........-> Enter Work
...................[whatever]
............<- Leave Work
...................Say "Going right home tonight?"
... ... ...

Wandering Around
....%FAMILIAR eq "0,0,0,0,0"
.........-> Guard Up
.........<- Guard Down

In Car
.....BT Connected [carID]
.........-> Enter Car
...............Set %FAMILIAR position 3 to "3"
..........<- Leave Car
...............Say "We're here. Let's go!"
...............Set %FAMILIAR pos 3 to "0"

I also have several "Cell Near" contexts of familiar places that simply Say "I smell home/work/friend/food/alcohol". My original thought was that these would be the triggers to enable/disable my WIFI Pinger to further save battery, but it turns out I am getting good battery life as is, so it is just fun to hear it announce when it's close to something it recognizes.

So, not only does it announce where I am or what I'm doing in real time, I can always look at which profiles are "green", or at my variables and see what my "FAMILIAR" string is, the last connected WIFI information, and last seen WIFI signals, etc.

Now for the FUN PART!

I added another profile triggered by shaking the phone that will slightly modify and read out all the currently active profiles. I impress my friends by shaking my phone and having it say:

"I am at a familiar place. I am in the car. I smell home."
or
"I am uncomfortable. I am wandering around. I smell alcohol. Wifi is On."

I've never had so much fun with my phone since discovering Tasker!

I know it's been a while, but are these profiles and tasks avaible?
 
Have you tried to do what you want yourself? Get back with us when you're stuck on something in particular.

I want to thank you for any help I can get. I don't know if this supposed to be in this thread or not. I'm just trying to get and understand the routine that SammB is doing. His post is above and there's a couple of things I don't understand, like
In Car
.....BT Connected [carID]
.........-> Enter Car
...............Set %FAMILIAR position 3 to "3"
..........<- Leave Car
...............Say "We're here. Let's go!"
...............Set %FAMILIAR pos 3 to "0"
I don't understand the Set %FAMILIAR position 3 to "3". I've never saw it before.
Another thing is there are quotes around his numbers. Are they supposed to be there? Ex: "*4*"
Last and hopefully least. I don't understand how the numbers are set in the %FAMILIAR variable.
I've tried to figure most of it out but got stuck.
Thank you.
 
Upvote 0
I've never seen it before either, not that I'm an expert. It looks like you're able to set comma separated variables within a single variable. Your giving it what position you want to set. It does have me intrigued. I've been reading a text file and parsing it. This might be better for what I'm doing.
The quotes don't get put in there. They indicate what the variable is supposed to be to someone reading this. But the asterisks are supposed to be there. Those are wildcards.
 
  • Like
Reactions: electricpete
Upvote 0
I've never seen it before either, not that I'm an expert. It looks like you're able to set comma separated variables within a single variable. Your giving it what position you want to set. It does have me intrigued. I've been reading a text file and parsing it. This might be better for what I'm doing.
The quotes don't get put in there. They indicate what the variable is supposed to be to someone reading this. But the asterisks are supposed to be there. Those are wildcards.
Ok, I think I've got the %FAMILIAR figured out. It is an array. After the split it displayed the correct number. The original number for the array is "0,0,0,0,".
Now the problem comes when I need to change the set of numbers. I've tried using array push with the correct values and when displayed it shows the correct number, but when I look at the variables there is no change. Any suggestions? I looked at the Tasker help section and from what I'm reading I'm following correctly.

Thanks again for your help.
 
Upvote 0
A push will add another variable to the array. I you don't pop one first, you will have more than 4.
So I guess what your saying I have to pop then push the array correct?
In other words if I pop "0,0,0,0,0" position 2 it will take out that position. If I push the position 2 it will move the others.

I tried pop then push position 1 and tried to change the "0" it to 4 and it displayed the 4 but didn't changed anything. I still get for the variable %FAMILIAR "0,0,0,0,0"
 
Upvote 0
You keep saying it is displayed. What do you mean by that? The best way to see the state of a variable is to look at the variable tab. If you want to know what is happening as you run it, add an alert such as a "say" after you change a variable. I do that all the time if I have a lot of if, else statements. If I can hear it make the changes, I know if it's doing what I want or not.
 
Upvote 0
It tends to be a challenge when you're trying to pick up someone else's project because they can have complicated logic built in there that is not obvious to the reader. If the author of that profile was reading this, I'm sure he could explain exactly what he was doing. For the rest of us, it would take some time to dig into his project to figure out the logic.

I think if you try to build your own projects starting small, you'll find it easier. Good luck!
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones