Disable Bluetooth - Phone Audio on Activating DND on phone - Tasker Tips & Tricks

My bluetooth headset has both Phone Audio and Media Audio options (checkboxes) under the Bluetooth device settings on my phone.
Essentially unselecting Phone Audio would prevent the Bluetooth headset from ringing when the phone rings.
When I activate DND mode on the phone the bluetooth headset still rings when connected to the phone. I want a solution in tasker for keeping the Bluetooth Media Audio on and turning off the Phone Audio for the Bluetooth settings.
I am a Tasker newbie and wasnt able to find the required setting under Actions or on this forum either.

I think the only way to do this is to set the global setting value that represents the state of that switch.
The value of;
bluetooth_headset_priority_XX:XX:XX:XX:XX:XX
(where XX:XX:XX:XX:XX:XX is the MAC address of the BT device)
Represents the state of the phone sink toggle. When set to 0, the phone (HPS) sink is off. When set to a number > 0 that represents the priority order the device is selected for that sink. In theory - I've not tested this - if a headset is set to 1000 and a car head unit to 100, the headset will be preferred for phone calls.
Toggle off:
Code:
A1: Custom Setting [
Type:Global
Name: bluetooth_headset_priority_XX:XX:XX:XX:XX:XX
Value: 0
Use Root: On
Read Setting To:
]
Toggle On:
Code:
A2: Custom Setting [
Type:Global
Name: bluetooth_headset_priority_XX:XX:XX:XX:XX:XX
Value:1000
Use Root: On
Read Setting To:
]
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini

Related

Tasker question - how can I turn on Bluetooth when WiFi goes off

So I've been trying to set tasker to turn on my Bluetooth when I get out of range from my homes WiFi signal.
Problem is I have no idea how to set tasked to do that.
Has anyone done this and possibly shoot me some info.
Sent from my XT1060 using xda app-developers app
I would do something like this:
Profile: BT Off at Home
Context: Wifi Connected [SSID:<YourSSID>]
Enter:
Bluetooth Off
Exit:
Bluetooth On
The exit task isn't really necessary if the Bluetooth was on before you connected to your home Wifi, but it ensures that you get the results you're looking for regardless of the Bluetooth state before the profile activates.
UncleMike said:
I would do something like this:
Profile: BT Off at Home
Context: Wifi Connected [SSID:<YourSSID>]
Enter:
Bluetooth Off
Exit:
Bluetooth On
The exit task isn't really necessary if the Bluetooth was on before you connected to your home Wifi, but it ensures that you get the results you're looking for regardless of the Bluetooth state before the profile activates.
Click to expand...
Click to collapse
I have a similar tasker situation setup on mine where if I'm not on WiFi my phone turned BT on and enables BT tethering. It is a bit more complicated than that though. Let me know if you'd like me to post it.
titanshadow said:
I have a similar tasker situation setup on mine where if I'm not on WiFi my phone turned BT on and enables BT tethering. It is a bit more complicated than that though. Let me know if you'd like me to post it.
Click to expand...
Click to collapse
I would definitely appreciate if you posted it
Sent from my iPad using Tapatalk
I use 2 profiles.
Enable BT Tether 1 is triggered when not connected to WiFi and executes "Enable Bluetooth Tethering" on entry and "Disable Bluetooth Tethering" on exit.
Enable BT Tether 2 is triggered when BT is turned when Bluetooth is on and does the same as above.
I use 2 profiles so that if Bluetooth is turned off when WiFi is also off, tethering enables itself again once BT comes back on. This also requites the use of an app called "Secure Settings" which can turn tethering on and off. When you turn tethering on if you're running a stock OS for your device it will check with your carrier (the OS does it, not Secure Settings) to see if you have that feature. This does not work if you use a 3rd party app to do tethering outside of the native OS method. If you are on CyanogenMod it does not check.
Enable Bluetooth Tether:
Code:
Profile Status BT Tether 1 ON
Profile Status BT Tether 2 ON
Secure Settings BT Tether Enabled if %WIFII !~ *CONNECTION*
Disable Bluetooth Tether:
Code:
Profile Status BT Tether 2 OFF
Secure Settings BT Tether Disabled
Now, I also have a much more complicated tasker series set up on my tablet to make sure my tablet always connects when wifi fails, but it took a lot more work to not waste battery power.
Auto Tether is triggered when not connected to WiFi and executes "Tether to Phone" on entry and "Disconnect from Phone" on exit.
Please note that where it says "Secure Settings Connect to Phone" the Secure Settings action used is "BT Connection" and you select your already paired device from the dropdown list. You can also set Secure Settings to toggle Bluetooth to ON if it is off, I don't have it say that way but it could be handy. I also found myself getting a lot of errors popping up as Toast notifications, but they were meaningless as the connection was established. Thus, I didn't worry about them and ended up disabling all notifications from Secure Settings.
Tether to Phone:
Code:
If %PhoneConnected = 0
Profile Status Monitoring Phone Connection ON
Secure Settings Connect to Phone
Profile Status Tether Search ON
Else
Profile Status Tether Search OFF
End If
Monitoring Phone Connection is triggered when the phone is connected via Bluetooth and executes "Phone Connected" on entry and "Phone Disconnected" on Exit.
Phone Connected:
Code:
Wait 1 Second
HTTP Get www.google.com:80
If %HTTPR=200
Variable Set %PhoneFailed to 0
Variable Set %PhoneConnected to 1
Profile Tether Search OFF
Else
Variable Set %PhoneFailed to 1
Variable Set %PhoneConnected to 0
End If
PhoneDisconnected:
Code:
Variable Set %PhoneConnected to 0
If %WIFII !~ *connection*
Profile Status Tether Search ON
Perform Task Tether to Phone if %PhoneFailed=0
End If
Tether Search is triggered every 5 minutes and executes Tether to Phone and has no exit.
I basically had to set it up this way because there is no way to have the tablet aware that it is connected to the phone at any given time, it'll execute an event but unlike WiFi there is no tasker variable for what devices are connected via Bluetooth using %PhoneConnected to manage this works very well. Using %PhoneFailed allows the script to be able to tell that a connection was attempted but unsuccessful, without this the tablet gets stuck in a loop always trying to reconnect once the phone goes out of range. I found this happening a lot when I would go to the grocery store and leave the tablet in the car after school. The battery drain wasn't extreme but it was there.
It is a little complicated, which kind of annoys me. One of these days I may get into Android programming and just make an app. But for now, this works. If the phone or tablet disconnect and are out of range, every 5 minutes a connection is attempted. If the connection drops, it does try once right away to reconnect, but then trips the Failed variable which prevents the tablet from going hardcore at trying to reconnect.

Tasker/Trigger NFC on Nexus 6

hi all
need some help with Tasker/NFC to run bluetooth in my car...here is what i have set up:
-Trigger set to run Tasker task (turn bluetooth on+set variable)
-Tasker profile to switch off bluetooth once disconnected from car bluetooth (wait 5 secs+turn off bluetooth+variable cleared)
the NFC trigger works flawlessly...its the exit task which doesnt! any suggestions/ideas??
thanks!
PS: Moderators please feel free to move this to another forum if posted incorrectly
When you say "exit task" do you actually mean exit task? Because that wouldn't make sense. An exit task is what is triggered when the context in the profile is no longer true and not part of a profile on its own.
Perhaps share some screenshots of your profiles
to clarify, its not an exit task but a separate profile...sorry for the misleading context.
have been playing around a bit with my setup..i noticed the following: when i place my phone on the nfc tag, Trigger launches the Tasker task of switching on bluetooth, the bluetooth indication comes on for about 3 secs and then disappears. during this time, the bluetooth off Tasker profile stays green (active) although i have a wait command of 20 secs before it should switch off bluetooth if not connected to any device.
hope that helps
kayeng said:
to clarify, its not an exit task but a separate profile...sorry for the misleading context.
have been playing around a bit with my setup..i noticed the following: when i place my phone on the nfc tag, Trigger launches the Tasker task of switching on bluetooth, the bluetooth indication comes on for about 3 secs and then disappears. during this time, the bluetooth off Tasker profile stays green (active) although i have a wait command of 20 secs before it should switch off bluetooth if not connected to any device.
hope that helps
Click to expand...
Click to collapse
I haven't got any nfc so can't test. What I'd recommend though is disable the off profile for now and make sure your nfc works properly and doesn't turn off after 3 seconds. Once that's done. We can look at the second profile.
For what its worth, I had lots of trouble with Bluetooth profiles.
Things for you to consider are that as soon as you turn on your BT, it will be *disconnected* which will trigger your 2nd profile. So you'll need to put a wait in there for a couple of minutes, THEN you will need to run an "IF" task, that then looks to check it is still disconnected before turning off bluetooth.
I found with BT that unnoticeable disconnections can happen for 1ms that will trigger the 2nd profile. It may be worth setting collision handling up to only run the newest task or the oldest task (whichever you think best)
i think i finally got things to work the way i want them to (well, not really, more on that later on)
1-use Trigger to run Tasker Task when tagged with nfc : Bluetooth on-->variable set (BT)
2-run Tasker Profile when connected to car to set new variable (Car)
3-run Tasker Profile when disconnected from car : wait 15 secs-->Bluetooth off-->variable clear BT and Car
the above setup worked 3 time without error and has me convinced that i have things setup correctly. not really sure if the variables are necessary, but have always used them so continuing with that theme.
the next and final step is to have Bluetooth turn on once sitting in the car without having to use nfc or touching the phone. had experimented with Secure settings and Tasker itself (BT near) but neither worked consistently. any Tasker plugin or separate app that i can use for that purpose? [running a rooted phone on stock 5.1.1 rom]
kayeng said:
i think i finally got things to work the way i want them to (well, not really, more on that later on)
1-use Trigger to run Tasker Task when tagged with nfc : Bluetooth on-->variable set (BT)
2-run Tasker Profile when connected to car to set new variable (Car)
3-run Tasker Profile when disconnected from car : wait 15 secs-->Bluetooth off-->variable clear BT and Car
the above setup worked 3 time without error and has me convinced that i have things setup correctly. not really sure if the variables are necessary, but have always used them so continuing with that theme.
the next and final step is to have Bluetooth turn on once sitting in the car without having to use nfc or touching the phone. had experimented with Secure settings and Tasker itself (BT near) but neither worked consistently. any Tasker plugin or separate app that i can use for that purpose? [running a rooted phone on stock 5.1.1 rom]
Click to expand...
Click to collapse
You can't use a Bluetooth trigger to turn on Bluetooth, because Bluetooth is off so can't be a trigger..

Automatic Call Forwarding: SOLVED

Answering a question no one asked but functionality I was after.
Borne of a good post on Reddit if your Android Wear watch is hijacking your bluetooth so your phone won't connect to your cars handsfree:
https://www.reddit.com/r/hwatch/comm...adset_profile/
It's a good app and works well for me.
Got me to thinking whether it could be adapted to automatically forward calls to my phone when out of bluetooth range and back to the phone's voicemail when connected via BT. The problem with the inbuilt call forward function is that when you turn it off it erases all the forwarding options including to the phone's voicemail. What the phone's option to turn off/on the forwarding does is send an MMI code to the cell network to update the forwarding options - the same can be done by just entering them numerically.
The list of MMI codes on wikipedia makes it a versatile tool:
https://en.wikipedia.org/wiki/Call_forwarding#Europe
Using the Reddit post as a guide I created 2 flows:
1) Forward to voicemail on BT connect -> Trigger: BT device connected (Urbane) -> Action: Call number *004*[voicemail number]#
2) Forward to Urbane on BT disconnect -> Trigger: BT device disconnected (Urbane) -> Action: Call number *004*[watch number]#
Works really well, so if I walk out of BT range the phone forwards calls to the watch if busy/unanswered etc and back to voicemail once back in range.
Hope this is of use to someone.

Tasker and strange bluetooth behaviour (connect/disc/connect within 2 secs)

The bluetooth connection to my car stereo behaves strangely: It connects, disconnects and reconnects within 3-4 seconds at startup. After that, everything works.
Sadly this triggers my Tasker profile to switch to on, then off, then on. That means every app I start when entering the profile is often killed (due to exiting the profile) and won't restart in time so that I've to do it manually.
Is there some chance to set the profile to be "connected to device X for at least 5 seconds" or any other trick?
The bluetooth device is sadly always the same, so I can't set it to Trigger to the 2nd connection attempt.
I'm having a similar problem with my Sony car stereo. If I am connected to my Bluetooth hands-free and I switch on the engine the car stereo is trying to connect to my phone. Since the phone is already connected to my hands-free it doesn't allow the connection to the car stereo to become active but tasker has already fired up the profile I have made for when I have my phone connected to my car and had also excited that profile because it sensed the disconnect. A delay like the one you propose would probably be a solution but I have no idea how this could be implemented in a task.
Following this thread for a possible solution.
Στάλθηκε από το HTC One M9 μου χρησιμοποιώντας Tapatalk
Put a delay and then use an if profile active/notactive block within your task. I do this with a few profiles to ensure they have truly started/stopped before running the associated task.
Put a delay and then use an if profile active/notactive block within your task.
Click to expand...
Click to collapse
I could not locate the "if profile active" block but i found a solution:
I've set the Tasks collision handline to "Run both together" and instead of Setting a variable like "InCar" to 1 once the Bluetooth connects, I simply increment it by 1 and all my other Tasks have "if %InCar > 0"...
When the task exits i simply wait for 30 seconds and then subtract 1 from %InCar. That way once I'm in the car the value goes 0 -> 1 -> 2 -> 1 (stays there while in the car) -> (once I Exit it).
I just use something like this at the start of some of my tasks:
Wait 30
If %PACTIVE ~ *,My profile,*
Rest of task
End if
This way the task will not run if the profile was only momentarily triggered.
I do a similar thing with exit tasks exit except I obviously check the profile is not active.

How get tasker to go back to most recent profile when one is inactivated?

I have a profile that sets my phone in silent mode when I'm at work.
It is set up with 3 states: wifi near, NOT Bt connected (my car) and NOT headset plugged (any)
The task is simply all volume set to 0. (With the use of tasker plug-in Sound Mode.)
Then have a profile that changes the sound mode to Vibrate Mode when I connect my Samsung Galaxy Buds+ to the phone (Samsung Galaxy S8.)
BUT how do I get tasker to go back to the last profile that was activated when I disconnect my buds?
I have a separate Volumes Task that I run when say, BT connected/disconnected. In that Task, I have Actions set for the various situations.
You could also have a Profile set to watch for another Profiles Active status.
Sent from my Note8
cableghost said:
I have a separate Volumes Task that I run when say, BT connected/disconnected. In that Task, I have Actions set for the various situations.
You could also have a Profile set to watch for another Profiles Active status.
Sent from my Note8
Click to expand...
Click to collapse
Ok. But what I want if that if I'm at work and my work profile is enabled and I connect my BT headset, the profile changes to my BT profile, and that's as it should. But when a disconnect my BT headset I want tasker to go back to the previous set profile, in this case my work profile. I don't know how to do that in tasker.
You could use variables. You could set a certain variable when work Profile active, and when you disconnect the BT, check for that variable to set work Profile as Active again.
Personally, I wouldn't set your BT headset as a Profile. Instead, just use simple Tasks that would auto-adjust your volume, display brightness, display timeout, lock, etc. And set your Profiles as Home, Work, etc. and make them all auto, based on anything, i.e. near a certain wifi.
Sent from my Note8
cableghost said:
You could use variables. You could set a certain variable when work Profile active, and when you disconnect the BT, check for that variable to set work Profile as Active again.
Personally, I wouldn't set your BT headset as a Profile. Instead, just use simple Tasks that would auto-adjust your volume, display brightness, display timeout, lock, etc. And set your Profiles as Home, Work, etc. and make them all auto, based on anything, i.e. near a certain wifi.
Sent from my Note8
Click to expand...
Click to collapse

Categories

Resources