Page 1 of 1

"Exit" tasks and NFC tags

Posted: 15 Aug 2014 12:01
by schnp
I just found out about Automagic yesterday and already find it more intuitive that Tasker, however I have a couple things that so far I cannot figure out. Sorry for the noobishness, I'm still learning.

1) How do I set up an "exit" task? For instance, when I plug in my headset, I want it to set my Media volume to 3, and when I unplug I want it to set to 0. I would also use this to turn off GPS when an app closes.

2) I want to use one NFC tag to do one thing if it's scanned once, and another if it's scanned >10 minutes later. Could I use a variable for this? I suppose I could check against when the variable was created and if it's >10 min it would lead to a different path in the flow.

A usability note: this would be so much easier to navigate if triggers, actions, and contexts were sorted by category, not just piled into one long list.

Re: "Exit" tasks and NFC tags

Posted: 15 Aug 2014 12:21
by kintrupf
schnp wrote:A usability note: this would be so much easier to navigate if triggers, actions, and contexts were sorted by category, not just piled into one long list.
+1

Re: "Exit" tasks and NFC tags

Posted: 15 Aug 2014 12:29
by kintrupf
schnp wrote:1) How do I set up an "exit" task? For instance, when I plug in my headset, I want it to set my Media volume to 3, and when I unplug I want it to set to 0.
Use Trigger Wired Headset Plugged (option Unplugged) with action Set Audio Volume.
schnp wrote:I would also use this to turn off GPS when an app closes.
Use Trigger App Task Ended with action Set GPS State.
However, depending on Android version you might need root to turn of the GPS!
schnp wrote:2) I want to use one NFC tag to do one thing if it's scanned once, and another if it's scanned >10 minutes later. Could I use a variable for this? I suppose I could check against when the variable was created and if it's >10 min it would lead to a different path in the flow.
Sounds about right. First time use a Script action to store the current time in a global variable like "global_NFCTime = triggertime", next time compare it with an Expression condition like "addMinutes(global_NFCTime, 10) < triggertime" to choose the second path.

Re: "Exit" tasks and NFC tags

Posted: 15 Aug 2014 12:39
by schnp
kintrupf wrote:
schnp wrote:1) How do I set up an "exit" task? For instance, when I plug in my headset, I want it to set my Media volume to 3, and when I unplug I want it to set to 0.
Use Trigger Wired Headset Plugged (option Unplugged) with action Set Audio Volume.

So I have to have two separate flows for this? I would have guessed that there was a cleaner way to do this, probably using True False contexts.
schnp wrote:I would also use this to turn off GPS when an app closes.
Use Trigger App Task Ended with action Set GPS State.
However, depending on Android version you might need root to turn of the GPS!

Root isn't a problem. Again though, it surprises me that this has to be a second flow. It seems repetitive.
schnp wrote:2) I want to use one NFC tag to do one thing if it's scanned once, and another if it's scanned >10 minutes later. Could I use a variable for this? I suppose I could check against when the variable was created and if it's >10 min it would lead to a different path in the flow.
Sounds about right. First time use a Script action to store the current time in a global variable like "global_NFCTime = triggertime", next time compare it with an Expression condition like "addMinutes(global_NFCTime, 10) < triggertime" to choose the second path.
Thanks for the gut check. I'll muck around with it and see what I can do. Variable were my hangup in Tasker though, thankfully, they seem more approachable in Automagic.

Re: "Exit" tasks and NFC tags

Posted: 15 Aug 2014 18:55
by kintrupf
You can of course combine the desired actions into one flow if you like. For simple flows this is no problem, but if they get more complexity is often advisable to seperate the logic into several flows...

You can add more than one trigger to a flow. So add one trigger for headphone plugged and one for unplugged and than separate the actions taken with the condition Wired Headset plugged.