I just discovered this command-line gem for switching audio output. Unpack the attached .zip file and put the executable wherever you like to have them. The .zip file also has the Xcode project to generate the executable, in case you are interested in looking at the source. (Warning: it is pretty deep.)
Once you have the executable in place just type AudioSwitcher in the terminal to get a list of options. Then use Execute Shell Script actions to invoke this from KM macros. (Remember to put in the full path.)
I have been switching audio output for a long time using a particularly unreliable GUI script. I am thrilled to have this command-line tool.
AudioSwitcher.zip (107.1 KB)