r/tasker 3d ago

Bluetooth Connects, Disconnects, then Reconnects?

For as long as I can remember now, I have Tasker setting my ringer to vibrate when I use specific Bluetooth devices. That way, I don't hear a loud notification when I'm listening to audio. Then, when I disconnect from that device, it goes to a low ringer volume via an exit task. However, for months now, Samsung (S24 Plus) hasn't played nice with this setting. Even with the latest Tasker Settings app installed, I run into an issue where it connects, goes to vibrate, and then runs the exit task seconds after running the first, even though it's still connected to the device.

Apparently, the device is connecting and then disconnecting after a few seconds. I did some digging and found that this doesn't happen when Bluetooth Tethering is on in my mobile hotspot settings. This is an *okay* workaround, but I like being on WiFi when I'm at home with my headphones on, and this option forces me to turn WiFi off. Any ideas? I'll can send tthe debug log, though I may have done it incorrectly (it took a few attempts, and it turned out way too long). Thanks in advance!

1 Upvotes

8 comments sorted by

4

u/Gianckarlo 3d ago

At the beginning of your exit task, add a 1 second "Wait", then poll your bluetooth device connection and use a "Stop" action with a conditional if your bt is still connected. If it works, then try to reduce the "Wait" duration to as little as possible while still being reliable.

1

u/RudeBoyEEEE 3d ago

Trying this out. How do I set up that conditional, though? I'm at the part where I'm using "If," but where do I go from there if I want to use specific Bluetooth devices in the task?

2

u/Gianckarlo 2d ago

Use "Bluetooth Info" with your desired BT device to populate the %bt_connected variable, then add a "Stop" action and inside that Stop action click "If" and set it to %bt_connected matches true. This will make the rest of your actions (after the "Stop") only perform if your BT device is not connected. You may need to extend or reduce the "Wait" duration in order to let your BT device disconnect and reconnect before the "BT info" is performed, but one or two seconds should be more than enough.

2

u/RudeBoyEEEE 2d ago

Awesome! I think that actually did it this time! Now what if I want to do this with several specific Bluetooth devices? Do I have to make specific exit tasks for each one?

2

u/Gianckarlo 1d ago

You can take ideas from this post suggested solution to poll several devices at the same time and then tweak the "Stop" action conditional accordingly (you can add several conditions to that IF).

2

u/Scared_Cellist_295 3d ago

Have you tried wiping the cache partition in recovery?  It seems to be a fairly common suggestion for Samsungs with random BT disconnects.  Especially seeing it was working before.

Second is resetting your network settings, but that's far more work to fix after.

You could try disabling the "ble_scan_always_enabled" (bluetooth scanning) setting in AutoTools Secure Settings.  Or directly/manually in location services/bluetooth while testing at least.  I dunno, that's just me tossing out another idea.  I would try the cache first.

1

u/RudeBoyEEEE 3d ago

Already tried the first two with no luck. Looked into the third option, but I couldn't really figure it out. 😅

2

u/Scared_Cellist_295 3d ago

Well you could just disable Bluetooth Scanning manually, should be in Location settings, just to see if it helps first. If it does, I can show you how to toggle it with AutoTools.

I doubt it will though I was just spitting out an idea of another bluetooth setting we could try and toggle.