Bluetooth-Autoconnect to Speakers from Command Line

My Desktop in the home office is always connected to the stereo, via Bluetooth. It sucks to click the BT icon or run bluetoothctl manually. Thus some time ago I fixed that by a little research and testing. Here’s what made me happy: 

I added the command echo -e “connect 0C:A6:94:D1:88:5D\n quit” | bluetoothctl to my files. For easier cut and paste: 

echo -e “connect 0C:A6:94:D1:88:5D\n quit” | bluetoothctl

In my case, I added that to my KDE Autostart script and I created an alias that allows me fast switching back after e.g. a Videoconference with a headset. My alias went to ~/.profilerc:

alias büro=’echo -e “connect 0C:A6:94:D1:88:5D\n quit” | bluetoothctl’

Works for me. 

Remember you have to replace the ID with the one from your device (delivered to you by the command devices in the bluetoothctl subshell): 

mfeilner@fibonacci:~> bluetoothctl
Agent registered
[Büro]# devices
Device D4:A6:B7:88:F4:9A D4-A6-B7-88-F4-9A
Device 34:DF:2A:45:E4:C0 Headphones
Device 0C:A6:94:D1:88:5D Büro
[Büro]# list
Controller FC:F8:66:E8:64:A7 fibonacci [default]
[Büro]#