Page 1 of 1

How to set a variable based on a location?

PostPosted: Thu Jan 08, 2015 9:45 pm
by robbert2012
On IOS, Mobilinc nicely can set an ISY variable when I'm in the location profile and reset that variable when I leave an area. How can I do the same on Android? On Android, I seem to have only the option to run a program, but the IF clause of the program should be "if I'm home" [then set home to 1 else set home to 0].

What am I missing?

Bert

Re: How to set a variable based on a location?

PostPosted: Sun Jan 11, 2015 12:57 pm
by AdminWes
Hi Bert,

To do this on Android you would use Tasker and the Auto-Location option for Tasker to setup a location based task. When the task fires (in or out of your location) have the task run a MobiLinc Program (using the free built-in Tasker plug-in support with MobiLinc) that sets a variable to a 1 when inside of your location and a separate program that sets your variable to a 0 when outside of your location.

Wes

Re: How to set a variable based on a location?

PostPosted: Sun Jan 11, 2015 6:26 pm
by robbert2012
On a Locaction Profile, I don't see a way to distinguish whether I'm entering the location or leaving it.

The "Mobilinc Event Configuration" has the "Event type", which is set to "program".
It also has the "Program" (only one program can be run).
It also has the "action", which can be "run if command", "run then command"...
I don't see any way to tell it to set a variable when entering a location and to reset a variable when leaving the location (the IOS MObilinc version does that very nicely). And I cannot do that with programs because I cannot distinguish between entering and leaving.

What am I missing?

The plugin also has an IF cause and one can test variables (I guess) and it also has a "label" checkbox. Not sure what the intention of this is. Maybe that is the magic I'm failing to grasp?

Bert

Re: How to set a variable based on a location?

PostPosted: Tue Jan 13, 2015 7:37 pm
by MechEng70
Do you have the autolocation with tasker?

To distinguish between arriving and leaving, when you created the original profile and first task, is there a green arrow next to the task? If so, that is the enter task(s). Now press and hold the enter task (while on the profile tab). A menu should pop up and you can add an exit task(s). Do you see that?

Re: How to set a variable based on a location?

PostPosted: Tue Jan 13, 2015 7:45 pm
by MechEng70
To set a variable; think this way.... You are not setting a variable in tasker. You are going to run a mobilinc program in tasker to set the state variable on the ISY.

So to start, you can create a program on your ISY called "Away". Also need to create a state variable called $sAway for this example.

Program "Away"
Leave the " if" blank.
then $sAway=1
else $sAway=0

Mobilinc
If tasker profile indicates in the geofence then run program Away else
If tasker profile indicates outside the geofence the run Away then

Back to ISY
now create a program based on if $sAway is true and the one for if $sAway is false.

Does that help?

Re: How to set a variable based on a location?

PostPosted: Fri Jan 16, 2015 9:38 pm
by robbert2012
Thanks for pointing out the exit task! Works great now.

Re: How to set a variable based on a location?

PostPosted: Sat Jan 17, 2015 4:02 pm
by AdminWes
Thanks MechEng70!

Wes

Re: How to set a variable based on a location?

PostPosted: Tue Jan 20, 2015 1:20 pm
by MechEng70
No problem.... try the AutoVoice in tasker... I have created one program that listens the keyword "turn" and then takes the next word or two for the device and the last word for the action (on/off)... have fun.

You mentioned the IF under the mobilinc plugin, that is were it becomes powerful. For each action, there is a plugin task that has two IF statements: IF %Device="living room" and IF %DeviceAction="ON" then run Living Room On.