by Kevin Mickle
I created this flow to toggle on/off a Bluetooth connection to my Motorola DECK speaker. I've tested it pretty thoroughly with my devices and have ironed out a few bugs. It should work wonderfully now.
You'll want to edit the BT device to your preference in each of the steps (connection checks, connection/disconnection attempts, and toast notifications). Additionally, you may want to play around with the delay on the "connect" side of the tree. I've found that my phone makes the connection immediately, but Automate doesn't see the connection update for at least 30 seconds. Yours may update earlier, or later than that, so play around and see what works best.
The reason there's not a shorter delay loop on the "connect" side like there is in "disconnect" is because I realized that if I pressed the toggle button on accident while I was away from home, it would continuously try to connect without me realizing. Now it's just a much longer delay and no loop. If it doesn't make (and see) the connection in 30 seconds, the flow will terminate and give you an "unavailable" toast notification.
The loop on the "disconnect" side is not going to run into the same issues because it will only attempt that side if the BT device is already connected. That loop is only there so that I don't get the toast notification until Automate sees that the device is disconnected (again, the connection happens pretty much instantly).
Reviews and ratings can be submitted in the app.