How to set a variable based on a location?

Share how you want to integrate with Tasker!

How to set a variable based on a location?

Postby robbert2012 » Thu Jan 08, 2015 9:45 pm

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
robbert2012
 
Posts: 8
Joined: Sun Dec 14, 2014 7:49 am

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

Postby AdminWes » Sun Jan 11, 2015 12:57 pm

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
AdminWes
Site Admin
 
Posts: 2058
Joined: Sat Feb 07, 2009 2:52 pm

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

Postby robbert2012 » Sun Jan 11, 2015 6:26 pm

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
robbert2012
 
Posts: 8
Joined: Sun Dec 14, 2014 7:49 am

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

Postby MechEng70 » Tue Jan 13, 2015 7:37 pm

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?
MechEng70
 
Posts: 13
Joined: Wed Nov 26, 2014 5:47 pm

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

Postby MechEng70 » Tue Jan 13, 2015 7:45 pm

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?
MechEng70
 
Posts: 13
Joined: Wed Nov 26, 2014 5:47 pm

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

Postby robbert2012 » Fri Jan 16, 2015 9:38 pm

Thanks for pointing out the exit task! Works great now.
robbert2012
 
Posts: 8
Joined: Sun Dec 14, 2014 7:49 am

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

Postby AdminWes » Sat Jan 17, 2015 4:02 pm

Thanks MechEng70!

Wes
AdminWes
Site Admin
 
Posts: 2058
Joined: Sat Feb 07, 2009 2:52 pm

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

Postby MechEng70 » Tue Jan 20, 2015 1:20 pm

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.
MechEng70
 
Posts: 13
Joined: Wed Nov 26, 2014 5:47 pm


Return to Tasker Integration

Who is online

Users browsing this forum: No registered users and 1 guest