Bluetooth speaker as media player

Hey I’m using Broadcom - BCM20702A0 (I’ve updated recently the instruction with info about BT used). In general here you have a list of BT compatible with HA - Bluetooth - Home Assistant

after “scan on” I’ve tried several time entering/re-entering pairing mode until you spot on the console a [NEW] device detected matching your MAC address. Then it should go forward with pair & trust.

1 Like

Yay, it worked! Thanks for the tip. The missing key for me was spamming that pairing command until it worked. Before I rather spammed scan on and devices to check if it sees it - and when I saw it in the list I tried pairing. Also, I had to throw away my CSR 4.0 adapter that just crashed during the pairing process and needed to restart everytime. Now I’m using EDIMAX BT-8500 which can successfully connect (after few restarts of HA and spam of pair commands).

Btw, here are my steps to get HA play media on BT speaker for others in future (as I always found small fragments of a solution, not a complete package):

  1. Do all previously mentioned stuff to pair and connect BT speaker.
    TLDR:
    Get BT adapter. Spam following commands until it works:
bluetoothctl scan on
bluetoothctl devices
bluetoothctl pair xx:xx:xx:xx:xx:xx //use address you find through devices command
bluetoothctl trust xx:xx:xx:xx:xx:xx
bluetoothctl connect xx:xx:xx:xx:xx:xx

Some extra useful commands:

bluetoothctl info xx:xx:xx:xx:xx:xx //to see if it's paired/connected/trusted successfully
bluetoothctl show //information about adapter
bluetoothctl help //to see all available commands/settings
  1. Get it registered as audio device with commands:
ha audio restart
ha audio reload
ha audio info

(repeat until you see it in info)
3) Get VLC add-on.
4) Set VLC to that new output (in add-on settings; needs restarting add-on)
5) Play media via interface or any automation (You can use action Play media or there are some advanced actions available as services - starting with media_player. )

10 Likes

Glad you got it to work for you.

This is working for me, thank you for the write up :grin:

EDIT: Turns out I just skip the audio restart command and it works!

I’m trying this with a JBL Charge 4 with a ZEXMTE DG-69 adapter, running on a generic x86_64 machine, and every time I run “ha audio restart”, my speaker disconnects :frowning:

1 Like

Great write-up. Really appreciate summarizing it all in one spot. I’ve got this working nicely with a Roku Streambar.

However, we use the Streambar as an HDMI TV output source, plus my wife will connect to it over Bluetooth and stream her own playlists, etc. Additionally, we have the Streambar and everything else in the “entertainment center” on smartplugs that we turn off when we’re done using them. Once I had this all set up and working, I figured I’d test to see how HA/Linux/bluetoothctl handled the BT device being powered down and back up. As expected, VLC didn’t just work, even though bluetoothctl showed connected. I’ve tried cycling through these steps again, and it’s hit-or-miss. I suspect it is a timing issue. For now, we may just leave the Streambar on, but I wish it was all much more clean.

However, should I find the exact timing combo of these commands, is there a way to issue the bluetoothctl and ha audio commands in an ha script?

thank you so much :slight_smile: its working very well !

one question, it is possible to pair more than one BTS, and how to “name” or select to witch BTS i want to stream media ?

Hi all,

I connect a JBL3 Bluetooth speaker to HA which is working on the command line by bluetoothctl connect. The problem is, after restart, HA does not automatically connect to the Bluetooth speaker again. The device is paired and trusted, but I need to connect manually again.
Is there any way to add an auto connection to this device (maybe in configuration.yaml)?