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.
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.
Thanks very much for this write-up, this worked very well for me! i have the same “issue” with the audio page not remembering my settings, but it works.
Is the antenna architecture of the wrover chip different to the wroom, since with wroom it’s impossible to use wifi and bluetooth simultaneously as they share the same antenna. I can’t see different antennas with wrover chip. But since you already get this to work, I think it’s possible or did you expirienced any issues?
Thanks for sharing this! It worked perfectly with my setup, and I found that the latest I2S-4MFLASH-16 version doesn’t require any updates.
I’ve also designed a compact 3D-printed enclosure for the ESP32 and documented the firmware installation process. I’m sharing it here in case anyone finds it helpful:
Have you tried the above with Music Assistant by any chance? Since it has inbuilt LMS running can we utilize that along with esp32 running Squeezelite?
I can confirm that esp32-wrover-b flashed with Squeezelite firmware is working fine with Music Assistant. We have to make sure the player provider Slimproto(squeezebox players) is added for it to detect the esp32. The only issue I am facing is, the name of esp32 is not getting reflected. It is showing as “unknown device along with MAC address” of its WiFi. However the playback is not impacted. I am able to play TTS notification as well as music without any glitch over Bluetooth Audio.
I am waiting for DAC to be delivered by this week end. Have you made any progress with this?
(Editing my previous one as per the forum rule asking me not post more than 3 posts)
I can confirm that esp32 running with squeezelite is running great with external DAC (UDA1334A) perfectly in stereo mode. I can share the details if anyone is interested.
Which model is your esp32? The squeezelite requires SRAM, it will work fine in esp32 wrover-b boards and not in esp32 wroom. If it is esp32 wroom, try the esphome I2S yaml method that may work. I have found the I2S works fine for announcements, it frequently hangs when you play music. YMMV.