I finally got this working faultlessly. I have to follow a very specific order:
- If bluetooth speaker is currently connected but audio is only coming out via HDMI, then disconnect the speaker via shh/bluetoothctl
- In OSMC, go to Settings>System>Audio and choose analogue as sound output device.
- Restart OSMC
- Make bluetooth speaker discoverable
- ssh into OSMC
- at the OSMC command line, type ‘bluetoothctl’
- type ‘agent on’ and hit enter
- type ‘scan on’ and hit enter
- wait for the mac address of the speaker to appear
- type ‘trust [mac address]’
- type ‘pair [mac address]’
- bluetoothctl will at this stage say the speaker is paired and connected. then, a few seconds later, will say the speaker is not connected. ignore this.
- type ‘connect [mac address]’
- and the speaker connects! In OSMC, go to Settings>System>Audio and choose bluetooth as the output device.
This is using a UE Boom 2 and this → Bluetooth 4.0-Adapter, USB-A | Bluetooth | Notebook & Computer | 2direct which I got from German ebay. for 8 euros.