Automate Switching BT Earbuds Between Devices

I have a pair of Soundcore bluetooth earbuds. I usually use them with my iPhone, but at times I would like to pair them with my MacBook Air or iPad. What I will usually do to accomplish this is to go into the iPhone settings, disconnect them, go into the Mac bluetooth setting and connect them. Then, reverse the process when I want to go back to the iPhone. More often than not, I keep a couple of dedicated devices (of much lower quality) to use with the Mac and iPad. The earbuds are paired with all devices, so it should just be a matter of doing the disconnect and reconnect with automation.

I am a believer in the creed that if you are doing something often, automate it! Is there any way to automate this process? I’m running iOS15, iPadOS15 and Monterey Public Beta. I have all the usual apps, e.g. Keyboard Maestro, Shortcuts, Alfred. My guess is that it might take 1 or 2 processes for each device (disconnect/connect for each device), although maybe it could be solved with 1 process that would toggle the connected state of the earbuds.

Any thoughts?

Thanks for the help.