Disconnect all Bluetooth devices except

Hello everyone,
I'd like for my macro to disconnect every Bluetooth device it is connected to, except my watch and a specific speaker. Is there a way to do it, except telling it to disconnect every specific Bluetooth device it knows (except those 2), or turning Bluetooth off?

Thanks!
 

tanutanu

Well-known member
Hello everyone,
I'd like for my macro to disconnect every Bluetooth device it is connected to, except my watch and a specific speaker. Is there a way to do it, except telling it to disconnect every specific Bluetooth device it knows (except those 2), or turning Bluetooth off?

Thanks!
You can use Bluetooth configure action when Bluetooth event trigger fired, some of the BT device might attempt to reconnect very frequently though. If you don't need such BT devices at that moment for a while, simply power off them manually if they don't have auto power off features.
 
Thanks for your answer.

I'd need this for an alarm to sound, so I need to make sure the right Bluetooth receiver is connected (I have BT receivers hooked up to analog speakers that may be too far to hear). I'll try to use a sound channel that always uses the smartphone's built-in speaker then...
 

tanutanu

Well-known member
Thanks for your answer.

I'd need this for an alarm to sound, so I need to make sure the right Bluetooth receiver is connected (I have BT receivers hooked up to analog speakers that may be too far to hear). I'll try to use a sound channel that always uses the smartphone's built-in speaker then...
Well, in most cases, BT devices tend to keep their connections and try to reconnect when a device is disconnected eventually. So people want to force reconnect if a speciftc BT device doesn't do as designed. It sometimes happens as you know.
In your case, I think you just want to keep connecting to your BT receiver for the legacy speakers. If so, simply reconnect when it disconnect. Then it should keep active because the last connected audio device is prior than previous one, even if you have a bunch of BT audio devices.
To guarantee that, it is good idea to disconnect any others like this sample macro.
If I misunderstood your issue, please let me know.
 

Attachments

  • Screenshot_20211008-144255_copy_1080x954.png
    Screenshot_20211008-144255_copy_1080x954.png
    79.3 KB · Views: 19
It may be that I'm not understanding properly what you are meaning, I don't really see how I can solve this problem with your solution (I see how it could work in a context where I need this one speaker to be connected)

I'll try to explain in other terms what I'd need to do (I think I wasn't clear in my explanation) :

Disconnect every Bluetooth device (since I don't know where they are or how loud they are)

Except

- My watch
- One specific speaker of which I know the location and the loudness

Thanks for your help
 

tanutanu

Well-known member
It may be that I'm not understanding properly what you are meaning, I don't really see how I can solve this problem with your solution (I see how it could work in a context where I need this one speaker to be connected)

I'll try to explain in other terms what I'd need to do (I think I wasn't clear in my explanation) :

Disconnect every Bluetooth device (since I don't know where they are or how loud they are)

Except

- My watch
- One specific speaker of which I know the location and the loudness

Thanks for your help
Well, I understood you wanted to disconnect all BT devices, excluding above 2.
So, I asked me again and again what the purpose is? I imagined your environment and wondered you just wanted to keep the 2 devices connections active prior than any others such as earphones, handsets, smart speakers etc. These devices should conflict because only single device could occupy the sound media stream of your mobile at the same time. So I supposed what you really need might be holding the connection to the receiver for the analog speakers ONLY. Your smartwatch doesn't conflict with the receiver and it doesn't matter a bunch of media playable devices are connected to your mobile or not, if the receiver is active, still occupy the media stream. Is that thought correct or just my misunderstood?

EDITED: The sample macro is showcasing as:
AV amplifier AVR-X4300H -> Your receiver
Echo dot -> one of your BT music devices
If another BT device connect to your mobile, it will be disconnected. Then your receiver connect, it will be active. If the other device try connecting again, it will be disconnected again. I afraid the retry activities. I'm not sure your devices give up or not.
 
Last edited:
Hmmm okay you're right I didn't explain the environment correctly.

This is to be used in a macro responsible for waking me up. Therefore, I need to make sure I'll be able to hear the sounds without me doing anything (eg. turning a device on or off)

I usually fall asleep with music on, but I don't always use the same BT "speaker" (headphones, portable speaker, BT receiver + speakers...). The problem is especially true with headphones (I can't wake up if the alarm is ringing through my headphones only). The one speaker I allow being on is the one I know the position of, and the volume levels (it's also the one I use to listen to music in the morning). If this BT speaker cannot be used, I want the alarm to go through my phone's speaker.

I *could* tell the macro to disconnect every Bluetooth device it knows one by one but I'm lazy and I don't like brute forcing things when it's not smart doing so.

I *could* also disable Bluetooth, and try reconnecting both my watch and this specific speaker, however I don't like the idea of stopping the music (and having disconnected/connected sounds)

And I can't just tell it to connect to the speaker because it's not always available (it could've turned off during the night)

Your thought is correct, as only 1 BT device can have the sound stream. However multiple BT sound devices can be connected, and my specific speaker isn't always available to take the sound stream out of the hands of another device

I know this is a very, very specific use case, in a very specific environment
 

tanutanu

Well-known member
Hmmm okay you're right I didn't explain the environment correctly.

This is to be used in a macro responsible for waking me up. Therefore, I need to make sure I'll be able to hear the sounds without me doing anything (eg. turning a device on or off)

I usually fall asleep with music on, but I don't always use the same BT "speaker" (headphones, portable speaker, BT receiver + speakers...). The problem is especially true with headphones (I can't wake up if the alarm is ringing through my headphones only). The one speaker I allow being on is the one I know the position of, and the volume levels (it's also the one I use to listen to music in the morning). If this BT speaker cannot be used, I want the alarm to go through my phone's speaker.

I *could* tell the macro to disconnect every Bluetooth device it knows one by one but I'm lazy and I don't like brute forcing things when it's not smart doing so.

I *could* also disable Bluetooth, and try reconnecting both my watch and this specific speaker, however I don't like the idea of stopping the music (and having disconnected/connected sounds)

And I can't just tell it to connect to the speaker because it's not always available (it could've turned off during the night)

Your thought is correct, as only 1 BT device can have the sound stream. However multiple BT sound devices can be connected, and my specific speaker isn't always available to take the sound stream out of the hands of another device

I know this is a very, very specific use case, in a very specific environment
OK, I want to try the breakdown again,

First, you don't consider about the smartwatch because no way to reconnect by MD action. It should be reconnected by your mobile configuration automatically.
You have 3 options what I can tell you.

Macro A:
It means the same as the picture I posted on #4. To image it easily, I added the other sound devices from A to G.
Once your receiver is disconnected, the macro action try to disconnect all the others, finally your receiver get active. While the receiver is active, even if one of them is coming back, it has a possibility to keep the receiver active. If not or you don't still prefer it, try Macro B.

Macro B:
It is similar to A. Whichever the other devices connect again, the macro disconnect them. However, it has possibility to retry repeatedly if each device designed to do so as I afraid. Probably it is ok, all BT slave devices what I used never tried to reconnect, excluding the master mobile attempt to do.

Macro C:
It makes the mobile BT disabled once and enabled. As you know it stops the music play, so you have to add some more action to play music again. The pros is the mobile disconnect all your BT devices completely and the other devices no longer come back probably. I'm not pretty sure but the possibility is higher than B. You need to try it, if the macro B is not suitable to you. The cons could be recovered with additional play music again action(s).

If your mobile doesn't show you which active device is on settings app, you have to figure out the device behavior, but the last one is active in most cases.
I'm very sorry, it is hard to catch what I meant. Because English is not my first language.
 

Attachments

  • BT_A.png
    BT_A.png
    103.6 KB · Views: 19
  • BT_B.png
    BT_B.png
    153.7 KB · Views: 18
  • BT_C.png
    BT_C.png
    177.7 KB · Views: 15
  • Resized pictures - 1.png
    Resized pictures - 1.png
    89.9 KB · Views: 14

smibrandon

New member
Following up on this because I'm having a bluetooth-related issue, and the great minds as part of this discussion hopefully can help me.

The actions within Bluetooth Configure, Connect Audio Device and Disconnect Audio Device simply don't work for me. Period. I saw it noted above that some bluetooth devices will re-connect themselves (like my car, for example), but this isn't the case. I have two bluetooth headsets (specifically, headsets for talking on the phone, not headphones). I can go into my phone's settings and manually disconnect/connect these two devices without issue. But, Macrodroid won't do either for me. For what it's worth, I am able to Enable/Disable/Toggle Bluetooth, though.

Same issue on both of my phones:
Pixel 4, Android 11
Pixel 6, Android 12 (brand new, <1 week old)

Thanks!

edit: formatting
 
Last edited:

tanutanu

Well-known member
Following up on this because I'm having a bluetooth-related issue, and the great minds as part of this discussion hopefully can help me.

The actions within Bluetooth Configure, Connect Audio Device and Disconnect Audio Device simply don't work for me. Period. I saw it noted above that some bluetooth devices will re-connect themselves (like my car, for example), but this isn't the case. I have two bluetooth headsets (specifically, headsets for talking on the phone, not headphones). I can go into my phone's settings and manually disconnect/connect these two devices without issue. But, Macrodroid won't do either for me. For what it's worth, I am able to Enable/Disable/Toggle Bluetooth, though.

Same issue on both of my phones:
Pixel 4, Android 11
Pixel 6, Android 12 (brand new, <1 week old)

Thanks!

edit: formatting
Probably your headsets will be connecting via HFP. HFP is different than A2DP. It's not for media playback. However, most headsets have A2DP as well.
Most of them tend to reconnect via HFP prior to recover the last connection by the host cell phone without any macro assistance, but some are still disconnected. I think these slave headsets are turned them off by themselves due to timeout to reduce the battery draining. Normally the host retry several times via HFP, so the slave(s) wound be connected even if turned off, after it turned on by the host trigger automatically. It depends on the slave behaviors. Once they connected again, they could be switch their BT profile to A2DP through the negotiation by the host if needed.

Force connecting ANY BT headsets are impossible if the slave(s) has possibility to disappear when MD trigger set. While setting MD triggers, the host attempt to do via A2DP same as another headphone, speakers or so. If no slave respond, it means the slave auto reconnect via HFP was failed in advance and has no ability to reconnect via A2DP. In this case, MD can't do anything because MD support A2DP only. I think Plantronics, Motorola, Jabra, Sennheiser, Jawbone are reliable in my experiences, but some other Chinese cheap products including OEM are not.

If you want to enforce to connect via A2DP on BT headsets, disabling HSP is available, however for automation, you have to set it using UI interaction actions. You can reach the BT slave list on setting app directly, but after that, tapping gear mark just beside each, then tapping enable/disable HFP should be done by yourself. Yes, you can, but it is hard to write enough reliable macro unfortunately. So I recommend you to look for some BT connection assistant app on Play store. I think these apps might be designed with such behaviors well considered and to cover widely.
 
Top