Auto-connect Bluetooth on moOde reboot

Installed moOde on an old Pi and paired it with Audioengine A2+ speakers via Bluetooth. MoOde does not auto-connect trusted devices on reboot by default. Using SSH, find your device MAC address, create an auto-connect script, set it to run at boot with cron, and enjoy seamless music!

Auto-connect Bluetooth on moOde reboot

I recently installed moOde on an old Pi I had lying around, and I connected it to a pair of Audioengine A2+ speakers I bought recently. There are several connection options: Bluetooth, RCA, USB, and a 3.5mm AUX input. For my setup I went with Bluetooth.

After using moOde for less than an hour, I discovered a small annoyance - when rebooting moOde I noticed that Bluetooth connections to trusted devices are not automatically connected. The standard functionality within moOde doesn't support auto connection, but a quick discussion with Perplexity provided a working solution via a simple cron script.

Amazon.com: Audioengine A2+ 24 Bit 60 Watt Bluetooth Desktop Computer Speakers for Music and Gaming - PC MAC Laptop Tablet : Electronics
Amazon.com: Audioengine A2+ 24 Bit 60 Watt Bluetooth Desktop Computer Speakers for Music and Gaming - PC MAC Laptop Tablet : Electronics

*Disclaimer: Affiliate link

Connect you moOde player to the device you wish to auto-connect toGo into settings, renderers, and then open the Bluetooth control panel.

From here, scan for devices and pair with the selected device.

SSH into moOde and use the following commands to determine the Bluetooth devices MAC address.

bluetoothctl
devices

You should see something like the following:

macleod@moode:~ $ bluetoothctl
Agent registered
[Audioengine N22]# devices
Device AC:A9:A0:XX:XX:XX Audioengine N22

Copy the MAC address and 'exit' bluetoothctl, use the MAC address within the following script and save as /home/username/auto-connect.bt.sh.

#!/bin/bash
sleep 60  # Wait for full boot and Bluetooth service
echo -e 'power on
connect AC:A9:A0:XX:XX:XX
quit' | bluetoothctl

Adjust the sleep timer appropriately for the full start-up sequence of your device. Remember and make the script executable.

chmod +x autoconnect_bt.sh

Finally, create a cron job entry for executing the script at startup.

crontab -e
@reboot /home/username/autoconnect_bt.sh

Reboot to confirming timing and successful connect - enjoy your music!