[Tasker Help] Detact - Activity detection - Tasker Tips & Tricks

Recently, I stumbled upon this nice little app, called Detact. It uses the new Activity Recognition Transition API to detect your current activity (driving, running, biking,...). I use this app to automatically enable Bluetooth while I am driving, so that it connects to my car's Bluetooth system. Until now, it does the job properly.
The thing is: it will always enable Bluetooth while I am inside a driving vehicle. I would like to have it enabled while connected to my own car, but not while I am driving any other car. My idea would be some kind of task that will (periodically?) check if I am connected to my car. If not connected after a pre-defined amount of time (say, three minutes), the task (named "driving mode" for example) should be aborted and not re-enabled by the initial profile afterwards.
Any help would be highly appreciated.

So this takes 2 profiles to accomplish.
The first one is a check that the car BT is connected. The profile context is a BT Connected state and enter the connection information for your car. The associated entry task should set a variable (e.g. %CarBT to true). In this case, you must have at least one capital letter in the variable so its available to other tasks. The associated exit task is a variable clear for the above variable.
The second profile is your existing plugin context for Detact. The entry task I assume starts with a BT on action. Then add a 3 minute wait then a BT off action which has an if statement: IF %CarBT does not match true.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers

ktmom said:
So this takes 2 profiles to accomplish.
The first one is a check that the car BT is connected. The profile context is a BT Connected state and enter the connection information for your car. The associated entry task should set a variable (e.g. %CarBT to true). In this case, you must have at least one capital letter in the variable so its available to other tasks. The associated exit task is a variable clear for the above variable.
The second profile is your existing plugin context for Detact. The entry task I assume starts with a BT on action. Then add a 3 minute wait then a BT off action which has an if statement: IF %CarBT does not match true.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Click to expand...
Click to collapse
Thank you for your explanation :good: I will give it a try and report back if any question arises.

Short feedback from my side: the above mentioned solution by setting up two different profiles works as I intended it to run. Thanks again, @ktmom :good:

Related

tasker

Edited original post as now getting. a collection of tasker tasks i have going on and easier to keep them in the first post but Will help below if anybody wants to copy them, also if anyone else wants to post there's that will be good.
1st) have tasker to toggle settings like wifi brightness etc when i get to work. Reverts settings back when i get home. Produces notifications on watch.
2nd) sends a message to my wife when i say launch task 1 that tells her im on my way home.
3) launches a autowear location menu on the watch. In the menu i can select wether i want high accuracy or low and wether i want location services on or off atall.
4) when i charge my phone between 2230hrs and 0625hrs the watch is switched to screen off, Bluetooth off and phone set to vibrate. When its unplugged or after 0625 the watch is switched to always on and phone is muted.
5) mobile data on and off options via autowear.
6) detects when i have lost connection to the watch and immediately turns on GPS to record the location. Then notifies me on my phone with a map view. I fix generators for a living so i need to take my watch of sometimes or when i have a shower in the gym etc. If for whatever reason i forget it which is unlikely i will know where i last had it.
7) every morning when i take my phone and watch off charge it selects a different watchface every morning at random from a predefined list. (needs watchmaker to be installed)
8) using autowear so that when i start My Tracks on the watch it automatically starts my gps task for me.
9) little on screen widget that i can control my Xbox/sky/tv changing channels, volume, play and pause, go to Fifa 15, record that, turn everything off. Accomplished using autowear, autoremote, autoinput, and a redundant tablet.
I have only just began with tasker so my methods won't be the most efficient but they work. If anyone has better ways as i mainly using auto input then please get in touch.
Could you describe which apps you used to pull this off? Thank you
Yeah sure, was a app called Tasker that i used on my phone to create it all and then a tasker plugin called tasker wear i think.
I have since been tinkering with it.
The updated version now has the following options;
1) text the wife I'm on my way home.
2) turns Wi-Fi of, auto brightness on, sync off
3) opposite of 2.
4) closes and returns back to watch face.
With option 2 and 3 i get a notification of what has beebeen switched on/ off.
With option 1 it also activates option 3 ready for when i get home.
Also if i forget to do the above especially switch evereverything on it detects when I'm nearly home and does it for me.
check AutoWear tasker plugin from joao, you can do anything with it in combination with the other Autoapps.
TheKaser said:
check AutoWear tasker plugin from joao, you can do anything with it in combination with the other Autoapps.
Click to expand...
Click to collapse
I'll have a look at that thanks, currently going to create a task that switches between gps and battery saving location as you can't turn location of anymore. So will have it switch to gps when needed and back to battery saving when not.
Also going to see if i can switch to cinema mode when charging and lost connection to the phone together and to revert back to previous or new watch face when undocked and regains connection to phone.
Hi Phil, would love to hear how you get on with that.
Hi rusty,
Just finished putting something together.
I have tasker detect when it's on charge and if between 2230 and 0625, and if so it switches the watch screen to off, and Bluetooth of.
using a profile manger, that detects that the watch it's no longer connected so switches notifications on the phone back on.
The opposite is when it's unplugged it switches Bluetooth back on, turns the watch screen to always on and the profile manager then detects the watch so turns the phone to mute but watch still vibrates.
I can now sleep at night with no lights keeping me awake and the only thing i have to do is plug my phone in.
Just to note it was pretty simple to set up with tasker and autoinput.
TheKaser said:
check AutoWear tasker plugin from joao, you can do anything with it in combination with the other Autoapps.
Click to expand...
Click to collapse
Hi kaser, as you recommended autowear do you have any experience with it as i can't get my head round it and there isn't much on YouTube or Google to help out.
phil gpx said:
Hi kaser, as you recommended autowear do you have any experience with it as i can't get my head round it and there isn't much on YouTube or Google to help out.
Click to expand...
Click to collapse
Hi, sorry for the late reply, I was on holidays.
I do have some experience. You need to download AutoApps from Google Play and suscribe to the alpha testing. Then you can download AutoWear. For this you also need to joing the Google+ community where the developer is always nice and reactive when posting bugs, questions or guidelines. Posting at the community is the best thing you can do since AutoWear is still in Alpha and it improves every day and it is not too straight forward to understand, especially how it communicates with AutoVoice and how commands and parameters are passed to Tasker.
By the way, I have a similar profile telling my girlfriend when I get to work, when I leave work and when I have parked at home coming from work, which automatically trigger depending on my location and connection to my car's bluetooth or work's WiFi. You don't really need your watch for that
Cheers for replying.
I have already downloaded it and played around but can't get my head around the processes of the app.
I followed the guide for the voice screen but cant get new screens up or start tasks etc.
I'm usually pretty good at working things out but cant with autowear.
what is it you are trying to do? Do you have the latest version of tasker?
Yeah i have the updated tasker but just can't work out how to get from the voice screen too say a "4 menu screen" that has tasks i have set up. Not sure what i want to accomplish with tasker next but i know if i can understand autowear it would help.
Have you done anything with autowear.
I have done the above tasks in the first post with autoinput and taskerwear but that is just a series of notifications that you can select to start tasks.
my main use for autowear is to send whatsapp messages from scratch (whatsapp currently only allows to reply to messages).
To achieve this I open an AutoWear Voice Screen by shaking the watch, and say "write to XXXX and say YYYY". This triggers an AutoVoice profile configured to react to "write to (?<contact>.+) and say (?<message>.+) (using Regex)
Inside the task, I do an WhatsTasker plugin contact search of the variable %contact generated by the regex command. Once found, I text the %message to this contact using whatstasker.
The best thing to do is to read the variable descriptions in the task. For example, you create your profile of AutoVoice Recognized. Inside it, before clicking configuration, you can see all the local variables available and their description. These are usable within the task. Same thing goes for any autowear task, they are usable after calling the task.
For example, in my task, after finding the contact, I have an AutoWear confirmation screen with the picture of my contact, his name, and the message I dictated. And following that I have an if %awmessage (the output of this confirmation screen) is different to cancel, then send the message.
Hope this helps a bit!
Thanks buddy, i will try and emulate this tonight once the kids are in bed. Whatsapp was one of the things i have been thinking of doing, just wish there was a way of bringing up a previous conversation without waiting for a new message.
well maybe you can capture the messages as they come, along with the sender's name, and save them in a temp file. Then create an autowear screen that shows the content of this file when requested... but I guess it would be very difficult to make it work perfectly (especially with groups).
I have managed to create and implement a mobile data on and off switch into my interactive notification popup for system settings using tasker, taskerwear and autoinput.
I now have the ability to switch wifi, mobile data, gps on and off as well as high and low accuracy location services and change profiles from one notifaction popping up.
left watch behind
Currently trying to set up a tasker profile that when i get disconnected from my watch will activate gps, stores the location, notifies you where it is and shows you on the map.
Hopefully will never need it but you never know. I.e you leave it in the gym, at work etc
Is there already something that does something similar as struggling at the moment but will crack on if there isn't.
Any one let me know about how to get nearby cell tower ID in a single variable.
Otherwise, how to convert the context in profile as a task.
Ty
Sent from my Micromax A58 using XDA Free mobile app
I'm sorrlearning tasker but i think if you create a new profile that activates when you connect to that cell tower. Then create a task and set variable %whateveryouwantto to %CellID.
You should only have to do that profile once and the variable will be set and you can use it in your profiles and tasks.
On another note i got my lost watch profile working like a charm.
Great Job
TheKaser said:
my main use for autowear is to send whatsapp messages from scratch (whatsapp currently only allows to reply to messages).
To achieve this I open an AutoWear Voice Screen by shaking the watch, and say "write to XXXX and say YYYY". This triggers an AutoVoice profile configured to react to "write to (?<contact>.+) and say (?<message>.+) (using Regex)
Inside the task, I do an WhatsTasker plugin contact search of the variable %contact generated by the regex command. Once found, I text the %message to this contact using whatstasker.
The best thing to do is to read the variable descriptions in the task. For example, you create your profile of AutoVoice Recognized. Inside it, before clicking configuration, you can see all the local variables available and their description. These are usable within the task. Same thing goes for any autowear task, they are usable after calling the task.
For example, in my task, after finding the contact, I have an AutoWear confirmation screen with the picture of my contact, his name, and the message I dictated. And following that I have an if %awmessage (the output of this confirmation screen) is different to cancel, then send the message.
Hope this helps a bit!
Click to expand...
Click to collapse
It sounds great :good:
May you please share your work with screenshots or something else so I can make it work for me?
Thanks in advance and best regards

[Question] Best Practise to make a profile based on more than one variable state?

I would like to change my audio profiles based on different situations:
Audioprofile Normal
Normal audiosettings at daytime, when car is not connected and no meeting in calendar.
Audioprofile Night.
Silent audiosettings at nighttime, but only when I'm at home and car is not connected.
Audioprofile Car
Audioprofile in car when connected to bluetooth. Overwrites every other audioprofile.
Audioprofile Silent
Audioprofiles for meetings and special locations.
Every state has his own variable, like the daytime, the bluetooth connection, my location etc..
So I tought I could combine the variable states in a profile with "Variable Value" and the operator AND:
"[email protected]"
Variable Value
%Day=1
AND
%Meeting=1
AND
%Car=0
Enter Task=Audioprofile Silent
But I read this in the Tasker Wiki:
...
Warning: if you want to trigger on a variable and then take some action which sets the thing the variable represents you should use the Variable Set event instead. A Variable Value state will cause complications when the state exits and tries to restore the value again.
...
With "Variable Set" I can only query the value of one variable. That's not enough for my profiles.
How could I do this? Is the warning still valid?
JasMan78 said:
I would like to change my audio profiles based on different situations:
Audioprofile Normal
Normal audiosettings at daytime, when car is not connected and no meeting in calendar.
Audioprofile Night.
Silent audiosettings at nighttime, but only when I'm at home and car is not connected.
Audioprofile Car
Audioprofile in car when connected to bluetooth. Overwrites every other audioprofile.
Audioprofile Silent
Audioprofiles for meetings and special locations.
Every state has his own variable, like the daytime, the bluetooth connection, my location etc..
So I tought I could combine the variable states in a profile with "Variable Value" and the operator AND:
"[email protected]"
Variable Value
%Day=1
AND
%Meeting=1
AND
%Car=0
Enter Task=Audioprofile Silent
But I read this in the Tasker Wiki:
...
Warning: if you want to trigger on a variable and then take some action which sets the thing the variable represents you should use the Variable Set event instead. A Variable Value state will cause complications when the state exits and tries to restore the value again.
...
With "Variable Set" I can only query the value of one variable. That's not enough for my profiles.
How could I do this? Is the warning still valid?
Click to expand...
Click to collapse
What i would do create individual profiles based on time of day, power supply connection, wifi network connection, bluetooth device connection, etc. Each one of those trigger their own individual task which:
1. Sets a specific variable to "1".
2. Sets other settings specific to that profile (if needed).
3. Performs a separate task that change common settings all profiles share.
Then create exit tasks for each profile to:
1. Set specific variables to "0".
2. Set other settings specific to that profile no longer being active (if needed).
3. Performs that same separate task that changes common settings all profiles share.
The common task should be set up with a series of if/else statements for each condition you want. So if variables time of day and home wifi connected are "1", do this, else do nothing. if car Bluetooth connected set to "1", do this, else do nothing. Etc etc etc.
LeftyGR said:
What i would do create individual profiles based on time of day, power supply connection, wifi network connection, bluetooth device connection, etc. Each one of those trigger their own individual task which:
1. Sets a specific variable to "1".
2. Sets other settings specific to that profile (if needed).
3. Performs a separate task that change common settings all profiles share.
Then create exit tasks for each profile to:
1. Set specific variables to "0".
2. Set other settings specific to that profile no longer being active (if needed).
3. Performs that same separate task that changes common settings all profiles share.
The common task should be set up with a series of if/else statements for each condition you want. So if variables time of day and home wifi connected are "1", do this, else do nothing. if car Bluetooth connected set to "1", do this, else do nothing. Etc etc etc.
Click to expand...
Click to collapse
Thank you for your answer.
That could be a way to do it. I must think about it.
But is the warning still valid? I've a lot of profiles which base on variable states. I never have had any problems with them.
JasMan78 said:
Thank you for your answer.
That could be a way to do it. I must think about it.
But is the warning still valid? I've a lot of profiles which base on variable states. I never have had any problems with them.
Click to expand...
Click to collapse
I could be wrong, but I think it is saying not to trigger based on a variable. Meaning, a variable set to x causes y to happen. You can have a profile set a variable, but can get problems if a variable triggers a profile.
At least I think that's what it's saying...lol
That's exactly what I'm doing. A variable is set to 1, and a profile gets active because it checks the state "Variable Value" of this variable. This works fine for me, also the exit task as soon as the value is not longer 1.
The advantage of this method is, that I need only one profil which checks my location, appointments, bluetooth connection, etc.. The profile then sets the variable e.g. $Appointment to 1, and I can work with this variable in any other profile where I need to check if I've an appointment. If the name of the calendar change, I need only to change the name of the calendar in one profile.
And I can simply combine different variables to complex profiles.
Also, the wiki is old-ish, and not really all that up to date. So it is possible tasker has been updated to fix that issue since it was posted.
I found a good solution for me.
I've created a Tasker task, which checks the needed variables and executes the associated audio profile.
E.g. if %Day=1 then execute the task "Profil Normal", if %BluetoothConnected=Car then execute the task "Profil Car".
To execute the task I created Tasker profiles with the event "Variable Set" for every variable, which I query to choose the right audio profile. I left the value field emtpy, so everty time the variable changed the profile executes my task.
Now every time one of this variables changes, the task, which checks the values of the variables and calls the audio profile task, is executed.

Turn on Bluetooth when in motion.

Hello,
How can I have Tasker turn on Bluetooth whenever I'm in motion?
I have a connected vehicle and whenever I leaving work, home, shipping etc., I would like Tasker to turn Bluetooth on and when I'm not in motion for more than 10 minutes turn Bluetooth off.
Any assistance is appreciated.
Micheao
If you really v want this to be motion sensing, then I suggest the AutoLocation plug-in. It does required GPS to be on for most precision/accuracy. Additionally, your location will be constantly monitored so you're going to be draining the battery.
If this is too turn on Bluetooth to connect to the car radio and turn off when you've left the car, then I'd be using the Bluetooth near context.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
ktmom said:
If you really v want this to be motion sensing, then I suggest the AutoLocation plug-in. It does required GPS to be on for most precision/accuracy. Additionally, your location will be constantly monitored so you're going to be draining the battery.
If this is too turn on Bluetooth to connect to the car radio and turn off when you've left the car, then I'd be using the Bluetooth near context.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Click to expand...
Click to collapse
Yes, I want it to be motion sensing using the GPS and battery is not a problem. Is it a limitation with Tasker that makes it impossible to do?
Regards
Tasker is a framework first. Plugins add features that not all users will want. This method of using plugins helps keep the core app under control from a maintenance and size point of view.
You can create a task that gets your location, then gets a second location, compare those results and determine if the device is moving. Read Tasker's online documentation: location without tears.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Thanks for the no help
So what have you tried since the last post 2 weeks ago? How about you post your profile and indicate what's not working.
To do that, make sure it's named - not a default name assigned by tasker. Then long press on the name to highlight the profile. Go to the 3-dot menu and select export -> Description to Clipboard.
Then you'll be able to paste it. Be aware, it easier to use pastebin then link to a post here. If you paste in a post here, the forum software will convert all semicolons with characters after, typically "on" and "off" to emoticons making it very hard to read.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers

[HELP] Read location provider setting and write it to variable fails if empty

Hi,
I would like to read the secure setting "location_providers_allowed" and write the value to a variable named %Locmode.
When the task is executed and the location setting / variable is empty, which means the location mode is off, it should enable the location mode e.g. GPS.
But when my task reads the value of "location_providers_allowed" with the shell command "settings get secure location_providers_allowed" and it's empty / location mode is off, the variable is set to an invisible value.
When I build a check which queries if the variable %Locmode is set or not, the result is TRUE. But in the tab with the variables overview the value of my variable is empty.
If I execute an "Flash %Locmode" the shown message is "%Locmode".
Is this an issue? Is there another way to query if the location mode is off or not?
Nexus 5X with Android 8.1, rooted
Tasker 5.2.bf1
Thank you.
Jas Man
If the location mode is set to off, the variable %Locmode will not have a value so the flash action returns just the variable name. This is an "Uninitialized Variable" and the behavior you're seeing is described further down the Tasker user guide variables page.
When the location mode is high accuracy, your variable should return "gps,network", or battery saving mode it would return just "network".
In theory, just having the variable checked for "is set" would return true if location mode is anything but off. But because the variable is initialized in the process of reading the setting, it will pass the "is set" test but it will be empty causing Tasker to flash the variable name. I suspect this is an unintended gotcha, but it is working as currently designed.
Maybe better to test for the possible values rather than just if it's set.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Thank you @ktmom for the explanation.
I will try the opposite way to check if the location mode is on or not (IF %Locmode is GPS or NETWORK or WIFI)
JasMan78 said:
Thank you @ktmom for the explanation.
I will try the opposite way to check if the location mode is on or not (IF %Locmode is GPS or NETWORK or WIFI)
Click to expand...
Click to collapse
You could try using;
Code:
%Locmode !~ \%Locmode
That should behave in the manner you previously described. "!~" means "does not match" and we're specifying the variable contains nothing thus mimicking an "is set" test.
The \ character is being used as a Java regular expression match. In Java the character after the \ is evaluated and in this case it's the content of the variable %Locmode. So the expression is evaluating the variable %Locmode does not contain anything.
And thanks, because researching this caused me to learn something [emoji4]
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Code:
%Locmode !~ \%Locmode
Works! But for me a little bit to exotic, because I'm not very familiar with java. When I will edit this task in e.g. one year, I will have no clue why I did this in the past.
Maybe I will get a little bit more into this later. Thank you again.
Put a note to self into the task using an anchor. Plus sign -> Task -> anchor
Put your note into the input field then pause the action.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Wow, I'm using Tasker for many years now, but I've never realized the action "Anchor". Nice
Any input field on any action can give the same effect. You could use the input field in the action you have the if statement in. I just think the anchor action stands out more.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers

How to stop a profile from continuing to run

I created a profile that basically waits until I am outside of a Geofence location and is connected to my car BT. If both conditions are met, it will automatically close the garage door for me. I have another profile that does the opposite but opens the garage door when I am inside the Geofence location.
What I am wondering is that profile still shows as active even if the task runs and what I would like to do is stop the profile but since I am still connected to BlueTooth while driving, one of the conditions is still true so it still keeps the profile active. Is there a way to run the tasks one time then stop the profile?
steelersmb said:
I created a profile that basically waits until I am outside of a Geofence location and is connected to my car BT. If both conditions are met, it will automatically close the garage door for me. I have another profile that does the opposite but opens the garage door when I am inside the Geofence location.
What I am wondering is that profile still shows as active even if the task runs and what I would like to do is stop the profile but since I am still connected to BlueTooth while driving, one of the conditions is still true so it still keeps the profile active. Is there a way to run the tasks one time then stop the profile?
Click to expand...
Click to collapse
My answer to you may not be helpful ..................
I'm thinking to use Tasker build-in varilable " PROFILE ACTIVE ". This is %PACTIVE ( sort of like.
so that you may be able to puzzle around by adding an " if statement %PACTIVE > Profile name of your above either one > Matches "~" > "on".
Then, do something .......
hope other members has another quicker solution to your need.
Thank you very much., edmond
Thank you very much., edmond
Hello there!
simply add an action in your task to disable the profile once the task is executed. action Tasker-profile status-set profile name and disable,thats all.
You will have to set another task to enable the profile again if needed,like time context etc...

Categories

Resources