I managed to get a bluetooth receiver playing audio from Home Assistant. It uses a pretty bare ESP32 which functions as an A2DP Source (Music Sender) which itself receives its input audio from Home Assistant via WiFi.
Like this:
Internet radio → Home Assistant → local WiFi → ESP32 → Bluetooth receiver / speaker
I couldn’t find any clear tutorial on the web and setting up the ESP was pretty confusing as there are tons of options in the ESP32 squeezelite project and most users want to build a whole audio kit with the ESP. I just wanted the WiFi - BT “translation”.
Hopefully I can help someone by writing down my steps to get it working.
There are three main activities
- Get the ESP, flash and configure it
- Install LMS addon in HA
- Setup Squeezebox media player integration in HA
1. Get the ESP, flashing and configuring.
I found these the most complex steps
- get ESP32 WROOM unit (ESP32-WROVER-B 4Mb Flash 8Mb Psram) like this one on AliE
https://a.aliexpress.com/_dY83WTf
an ESP32-A1S might work similar, I haven’t tested. - flash the ESP via the website
Squeezelite-ESP32 Installer
pick generic - connect to its WiFi AP, pwd: squeezelite
- go to 192.168.4.1
- connect it to your own WiFi, reboot
- go to the ESP web interface on your network
- menu updates → pick a 16 bits version, I selected I2S-4MFlash-1335 (don’t know what version is the best, this worked for me)
not sure how I selected it but after quitting recovery mode it displayed at the bottom:
fw: I2S-4MFlash-1335, mode: Squeezelite-ESP32 - menu Credits → show NVS Editor
- menu NVS editor appears and open it.
a2dp_sink_name → is the name of you bluetooth receiver (as you see it in your phone when it outputs to that receiver)
bt_name → unclear if it has to be set? just do it
a2dp_dev_name → unclear if it has to be set?
enable_bt_sink → possibly, i guess not needed, but try it.
telnet_enable → y
→ Commit, reboot - menu hardware, no adjustments
- menu system, no adjustments
- menu audio, (for some reason this page keeps forgetting my adjustments, not sure if its faulty flash on the ESP or something I’m doing. Once i’ve set it, plus the NVS editor, my ESP works though)
select output to bluetooth
resample to Default
rate to 44100
2. Install LMS addon in HA
Add Phillip Camp’s repository
install the LMS Addon
Not much to configure, start it and it should detect the ESP unit automatically
3. Setup Squeezebox media player integration in HA
Add, search for logitech, then pick the Squeezebox (Logitech Media Server), it will scan and find your media player which can now be accessed thoughout Home Assistant! yay
Troubleshooting
- Connect to the ESP via telnet (or serial if all fails) to discover what’s happening on the ESP.
Useful resources