Turn off bluetooth if not connected

6,193 views
Skip to first unread message

Rickey Shortt

unread,
Jun 25, 2013, 8:32:50 AM6/25/13
to tas...@googlegroups.com
After putting it off too long, I finally started using Tasker a few days ago. Wow! Really cool, and I've figured out several things already. But I need help figuring out how to use Tasker to make Bluetooth turn off if it is no longer connected to a device such as my headset. I have tried several different things and only had mixed results with the following one. State is- Not Bluetooth Connected > set Bluetooth Off So I turn bluetooth on manually and connect my headset. Problem is, sometimes it works perfectly and other times it turns bluetooth off immediately after my headset connects. I can't figure out why. Any suggestions?

Rickey Shortt

unread,
Jun 25, 2013, 10:11:18 AM6/25/13
to tas...@googlegroups.com
 
I found this in a post by "Pent" on this forum a few minutes ago and it seems to be working for me so far. First, I changed the state to "Bluetooth Connected" then changed the task as described below. My words in (  )

Back in the main screen (under this profile), long click on the 
task you 
just created (in this case, my "Set Bluetooth Off" action)  and select Move To Exit.

Maybe it will help you too? I'm not sure exactly what Move to Exit means as compared to Exit Task though. Or what makes this different from simply being the action to initiate if "Bluetooth Not Connected" Still much to learn with this app!

Rickey Shortt

unread,
Jun 25, 2013, 11:09:15 AM6/25/13
to tas...@googlegroups.com
Just guessing here, after thinking about it for a while, but I'm assuming that by setting it up this way, it means that if Bluetooth is connected, there is no task - only an exit task for when bluetooth is not connected. Can anyone verify this so I will know I am right and why my profile now works?


On Tuesday, June 25, 2013 8:32:50 AM UTC-4, Rickey Shortt wrote:

Dave Fisher

unread,
Jun 25, 2013, 11:24:01 AM6/25/13
to tas...@googlegroups.com
Yep, thats correct. Basically:

When it is an entry task, it runs when the profile conditions are met.

When it is an exit task, it runs when the profile conditions are no longer met.

If the profile conditions are "Bluetooth connected", it is only active when BT is in use. If you want it to do something when no longer connected, you need the task to run in the exit task. You can only add a task as an Entry task by default. So once you added it, you need to select "Move to Exit" to change it from an Entry to an Exit task.

If you change the profile conditions to be "Bluetooth not connected", then it will be active all the time when BT is not in use. You could have your settings in the Entry Task then, but its kinda counter-intuitive if you think about it (I know it seems logical as you want to do something when its not connected, but in reality you want it to do it when its no longer connected, ie. trigger on the exit of the connected state).

Confused ? Welcome to Tasker :-D



--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Rickey Shortt

unread,
Jun 25, 2013, 11:30:32 AM6/25/13
to tas...@googlegroups.com
Thank you! That actually makes a lot of sense. Definitely a learning curve with this, but it is fascinating - and very satisfying when you figure something out and make it work. Even better when you understand why!


On Tuesday, June 25, 2013 8:32:50 AM UTC-4, Rickey Shortt wrote:

Rickey Shortt

unread,
Jun 25, 2013, 11:42:16 AM6/25/13
to tas...@googlegroups.com
What if I wanted it to sense that bluetooth was no longer connected, but rather than turning it off immediately, to first wait 5 minutes, then check again - and only turn bluetooth off if it was still unconnected - otherwise do nothing?


On Tuesday, June 25, 2013 8:32:50 AM UTC-4, Rickey Shortt wrote:

Wes Stacey

unread,
Jun 25, 2013, 11:51:16 AM6/25/13
to tas...@googlegroups.com
Indeed, the exit task should be as follows

wait 5 minutes
turn off bluetooth (if %PACTIVE !~ *<Profile name>*)

Replace <Profile Name> with the name of the profile. make sure to keep the *'s around the name though.

Rickey Shortt

unread,
Jun 25, 2013, 11:57:14 AM6/25/13
to tas...@googlegroups.com
Thanks! I may try it that way.

Rickey Shortt

unread,
Jun 25, 2013, 12:42:56 PM6/25/13
to tas...@googlegroups.com
Awesome! Working perfectly with a 5 minute delay.


On Tuesday, June 25, 2013 11:51:16 AM UTC-4, Wes Stacey wrote:

Matt R

unread,
Jun 25, 2013, 1:47:19 PM6/25/13
to tas...@googlegroups.com
You'll need to change the exit task properties to have task collison set to abort existing too.

Matt

Rickey Shortt

unread,
Jun 25, 2013, 1:51:25 PM6/25/13
to tas...@googlegroups.com
It seems to be working fine now - after limited testing. What will that do, and what will happen if I don't do that. Also, how do I do that. I think I saw that option somewhere either in Tasker, or in a post, but don't remember where.

Matt R

unread,
Jun 25, 2013, 2:09:55 PM6/25/13
to tas...@googlegroups.com
Bluetooth disconnects, 5 minute wait starts, Bluetooth reconnects, 4 minutes later Bluetooth disconnects again, 1 minute later the 5 minute wait finishes and turns off Bluetooth. You would expect the 5 minute wait to restart when the second disconnect happens.

Matt

Rickey Shortt

unread,
Jun 25, 2013, 2:30:38 PM6/25/13
to tas...@googlegroups.com
Ah. I can see where that could cause some minor annoyance with this task by turning bluetooth off when it should still be on. I can also see where it could cause much bigger problems with some tasks. I believe it was indeed another forum post somewhere that I read about a very similar "Wait" related task needing to be set up like this. I will try that, but at least in this case, it would only mean that I had to manually turn bluetooth back on if I connected a third time after the first five minutes had elapsed rather than the second five minutes. 

Thanks!
Message has been deleted

mhd.a...@gmail.com

unread,
Jun 25, 2013, 4:28:11 PM6/25/13
to tas...@googlegroups.com
I have profile for auto bluetooth, its works with me perfectly.

Profile: Auto Bluetooth (40)
State: Not Bluetooth Connected [ Name:* Address:* ]
State: Variable Value [ Name:%BLUE Op:Matches Value:on ]
Enter: bluetooth off after 1 (56)
A1: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ] 
A2: Bluetooth [ Set:Off ]

Exit: stop bluetooth off task (65)
A1: Stop [ With Error:Off Task:bluetooth off after 1 ] 


regards,

Mohammed

Rickey Shortt

unread,
Jun 25, 2013, 5:04:56 PM6/25/13
to tas...@googlegroups.com
Not sure I understand exactly what this does. I'm assuming it periodically turns bluetooth on, gives something a window of time to connect, then turns it back off for a period of time if nothing does? Then repeats the cycle? Or am I looking at it wrong? I'm not yet familiar with some of your settings. Please explain step by step what this profile does, if you would be so kind.

Thanks.
Message has been deleted
Message has been deleted

mhd.a...@gmail.com

unread,
Jun 26, 2013, 2:28:22 AM6/26/13
to tas...@googlegroups.com
please find attached links



The video about Auto wifi. The idea here is if the wifi not connected, it will switch off after period of time.
you can apply this profile with bluetooth also.

my previous profile ( Auto bluetooth ) i take it from this idea.


regard,
Mohammed

Dave Fisher

unread,
Jun 26, 2013, 3:55:54 AM6/26/13
to tas...@googlegroups.com
Basically it is:

Profile: Auto Bluetooth (40)
State: Not Bluetooth Connected [ Name:* Address:* ]
State: Variable Value [ Name:%BLUE Op:Matches Value:on ]

If Bluetooth is turned on (the value of which is stored in variable %BLUE), and it is not connected to anything...


Enter: bluetooth off after 1 (56)
A1: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ] 
A2: Bluetooth [ Set:Off ]

When conditions are met, run the tasked called "bluetooth off after 1", which will wait for 1 minute, and then turn Bluetooth off.


Exit: stop bluetooth off task (65)
A1: Stop [ With Error:Off Task:bluetooth off after 1 ] 

If the conditions are not met, ie. if Bluetooth turns off (%BLUE becomes off), or Bluetooth connects to an address, then run the task called "stop bluetooth off task", which will execute the Stop action, ending the task named "bluetooth off after 1"


So when bluetooth disconnects from a device, the Auto Bluetooth profile will activate, and it will wait 1 minute. If during that one minute a device connects, then the profile becomes inactive, runs the exit task which stops the enter task. Otherwise it will turn off bluetooth which will make the Auto Bluetooth profile inactive, and run the exit task which stops the enter task.

Pete Buonomo

unread,
Aug 29, 2013, 9:40:51 AM8/29/13
to tas...@googlegroups.com, mob...@the-darkside.co.uk
I've been trying this bluetooth auto-off profile, but for some reason if I include Variable %Blue = on OR bluetooth on contexts in the profile it will immediately re-enable bluetooth as soon as it is disabled, and I'm not sure why.  Removing this context from the profile and only having 'bluetooth not connected' context works fine... I don't know if it makes a difference if the profile is always on and trying to disable bluetooth or not without the bluetooth on context?

Pete Buonomo

unread,
Aug 29, 2013, 10:03:14 AM8/29/13
to tas...@googlegroups.com, mob...@the-darkside.co.uk
Seems like setting a custom variable instead of using tasker's built in bluetooth variable did the trick... not sure why but I'm not really asking questions :D

komobu

unread,
Nov 25, 2013, 12:36:10 PM11/25/13
to tas...@googlegroups.com
I could use some help with this. I use an app called smartphone link that communicates through Bluetooth with my garmin. When I run the smartphone link app, I want it to turn Bluetooth on first, then launch the app. When I close out of the app I want it to shut off the Bluetooth on exit. Is this possible? Is there a pair command instead of turning the Bluetooth on and off? Something like pair/disconnect pair?

Thanks for any help

Matt R

unread,
Nov 26, 2013, 1:39:01 PM11/26/13
to tas...@googlegroups.com
There's at least one plugin that's supposed to do that: https://play.google.com/store/apps/details?id=a2dp.connect

Matt

Jamie Henning

unread,
Jan 3, 2014, 12:25:05 AM1/3/14
to tas...@googlegroups.com
FWIW, I had to set mine like this for it to work.


Profile: Auto Bluetooth (40)
State: Not Bluetooth Connected [ Name:* Address:* ]

State: Variable Value [ Name:%BLUE Op:Is Set Value:on ]

Instead of "matches"

Rogelio Ant. Reyes Bautista

unread,
Jul 30, 2014, 1:02:48 PM7/30/14
to tas...@googlegroups.com
I had a similar problem with this profile, what i did instead was just to remove the option "Restore Settings" from the profile options. 

Aaron Miller

unread,
Dec 15, 2014, 5:07:12 PM12/15/14
to tas...@googlegroups.com
this was the issue w/ my tasker.
Reply all
Reply to author
Forward
0 new messages