Self-sustaining WiFi Flow - need help please
Posted: 25 Feb 2014 05:08
Hi there!
I'm a heavy Tasker user, and thought I would try out AM, so am in trial mode while giving it a spin on my work phone. I'm trying to build a task I already have working in Tasker, on my personal phone. I've setup 2 flows to try and make an automated WiFi enabler/disabler based on GSM Cell ID.
The way it's setup is as per below.
Flow 1:
Trigger:
WiFi Connected to Any SSID
Condition:
Phone Cell GSM: Connected to CIDs *
Actions (as per below):
1) When WiFi connects to an access point (this could be at home, work, friends house, etc, but basically, I go somewhere where I want to always connect to WiFi, ask for the password, and then connect to it), a flow fires off that checks the current GSM Cell ID, and then saves it into a text file, and also into a global variable if it's not already saved.
2) This flow will always fire when the phone connects to WiFi; the first couple of times I will have to turn on WiFi manually, as it hasn't yet saved all of the GSM Cell ID's in the area, but after having done that a few times, it becomes self-sustaining, and automatically turns it on when in that area in the future due to a second flow (below) that turns on WiFi for matching Cell ID's.
3) one of the things that the flow does is check to make sure it doesn't already have the GSM Cell ID saved in the global variable (which contains all of the Cell ID's of valid WiFi access points); if the Cell ID already exists, the flow stops (based on a comparison condition).
Number 3 is where my problem is. I can't seem to figure out how to compare the list of Cell ID's saved in 'global_cid' with the currently identified 'cid'. I've tried various expressions and permutations:
global_cid=cid
global_cid=='*cid*'
contains (global_cid, 'cid')
contains (global_cid, '*cid*')
Since this is contained in a condition, when I execute just the one step (or even the entire flow), I never get the response I'm expecting. I want it to be able to identify when one of the Cell ID's is already contained within the 'global_cid' variable, and if it's there, then DO NOT save the current Cell ID into the existing list, nor add it to the list of Cell ID's in the text file I'm writing to. I know for a fact that it's not working, because every time I go and check the value of the 'global_cid' variable, it has the same Cell ID listed multiple times. I want it to contains ONLY UNIQUE values. That way, the list is short and efficient, and keeps the task quick. I realize the size of the variable may not matter, but for efficiencies sake, I'd like to keep it clean.
The second flow, just to show you the whole picture, looks like this:
Trigger:
WiFi Disconnected
Phone Connected to {global_cid}
Display State: On
Action:
Set WiFi State: On
This flow will turn on WiFi if it's currently off, when the screen comes on, and the phone is connected to a known GSM Cell ID.
If WiFi connects to an access point, Flow 1 will fire and check to see if the Cell ID is already known (although redundant at this point), but for the sake of not knowing a Cell ID in that area while being connected to a known WiFi access point, it will then save it for future. If, however, the Cell ID is known, the flow will stop, based on the comparison condition in item number 3.
Can anyone help with the variable comparison that I'm looking for above in item number 3?
Also, side question:
In Tasker, a profile has contexts that control the triggering of tasks. When the profile goes active, it fires the enter task, and when it goes inactive, it can fire the exit task (to turn WiFi off, for example, using the above ideas).
In AM, do I need to manually setup a 3rd flow (for the WiFi state above) to turn OFF WiFi if I'm not connected to a known network, and am in an area where I don't have the Cell ID's saved? Basically, I'm asking if I have to create another flow to turn WiFi off, or is it automatic? Do the settings changed by flows reset to their original settings when the triggers are no longer valid?
I love AM's interface, and flow charting in general, so am really enjoying this so far.
Thanks for any help you all can provide!
I'm a heavy Tasker user, and thought I would try out AM, so am in trial mode while giving it a spin on my work phone. I'm trying to build a task I already have working in Tasker, on my personal phone. I've setup 2 flows to try and make an automated WiFi enabler/disabler based on GSM Cell ID.
The way it's setup is as per below.
Flow 1:
Trigger:
WiFi Connected to Any SSID
Condition:
Phone Cell GSM: Connected to CIDs *
Actions (as per below):
1) When WiFi connects to an access point (this could be at home, work, friends house, etc, but basically, I go somewhere where I want to always connect to WiFi, ask for the password, and then connect to it), a flow fires off that checks the current GSM Cell ID, and then saves it into a text file, and also into a global variable if it's not already saved.
2) This flow will always fire when the phone connects to WiFi; the first couple of times I will have to turn on WiFi manually, as it hasn't yet saved all of the GSM Cell ID's in the area, but after having done that a few times, it becomes self-sustaining, and automatically turns it on when in that area in the future due to a second flow (below) that turns on WiFi for matching Cell ID's.
3) one of the things that the flow does is check to make sure it doesn't already have the GSM Cell ID saved in the global variable (which contains all of the Cell ID's of valid WiFi access points); if the Cell ID already exists, the flow stops (based on a comparison condition).
Number 3 is where my problem is. I can't seem to figure out how to compare the list of Cell ID's saved in 'global_cid' with the currently identified 'cid'. I've tried various expressions and permutations:
global_cid=cid
global_cid=='*cid*'
contains (global_cid, 'cid')
contains (global_cid, '*cid*')
Since this is contained in a condition, when I execute just the one step (or even the entire flow), I never get the response I'm expecting. I want it to be able to identify when one of the Cell ID's is already contained within the 'global_cid' variable, and if it's there, then DO NOT save the current Cell ID into the existing list, nor add it to the list of Cell ID's in the text file I'm writing to. I know for a fact that it's not working, because every time I go and check the value of the 'global_cid' variable, it has the same Cell ID listed multiple times. I want it to contains ONLY UNIQUE values. That way, the list is short and efficient, and keeps the task quick. I realize the size of the variable may not matter, but for efficiencies sake, I'd like to keep it clean.
The second flow, just to show you the whole picture, looks like this:
Trigger:
WiFi Disconnected
Phone Connected to {global_cid}
Display State: On
Action:
Set WiFi State: On
This flow will turn on WiFi if it's currently off, when the screen comes on, and the phone is connected to a known GSM Cell ID.
If WiFi connects to an access point, Flow 1 will fire and check to see if the Cell ID is already known (although redundant at this point), but for the sake of not knowing a Cell ID in that area while being connected to a known WiFi access point, it will then save it for future. If, however, the Cell ID is known, the flow will stop, based on the comparison condition in item number 3.
Can anyone help with the variable comparison that I'm looking for above in item number 3?
Also, side question:
In Tasker, a profile has contexts that control the triggering of tasks. When the profile goes active, it fires the enter task, and when it goes inactive, it can fire the exit task (to turn WiFi off, for example, using the above ideas).
In AM, do I need to manually setup a 3rd flow (for the WiFi state above) to turn OFF WiFi if I'm not connected to a known network, and am in an area where I don't have the Cell ID's saved? Basically, I'm asking if I have to create another flow to turn WiFi off, or is it automatic? Do the settings changed by flows reset to their original settings when the triggers are no longer valid?
I love AM's interface, and flow charting in general, so am really enjoying this so far.
Thanks for any help you all can provide!