ESP32-Audio-Kit (ESP32-A1S) with Squeezelite for Notifications

Just purchased the ESP32-Audio-Kit board from Ai-Thinker (ESP32-Audio-kit | 安信可科技) which uses the ESP32-A1S. Anyone have experience with (or knows of any tutorials about) setting this up with ESPHome?

My ultimate goal is to use this as a device to play audio notifications. I’ve seen people lamenting that there’s no simple, economical solution for audio notifications in HA and it seems like this could be a good solution. Has both speaker and headphone outputs, an SD card for storing audio files, and support for ESP-ADF.

I was looking at the documentation for DF-Player (DF-Player mini — ESPHome) and wondering if that would be be of any use? Something simple like the dfplayer.play action where the notification from HA would be a command to play file X on the SD card would work great.

I have only very rudimentary programing and electrical engineering skills, but I’d be happy to write a tutorial if someone could assist with the technical stuff.

1 Like

I am using a D1 Mini with a DFPlayer Mini for audio announcements. This is my ESP Home setup:


esphome:
  name: d1-mini-speaker

esp8266:
  board: d1_mini

# Enable logging
logger:

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  networks: 
    - ssid: !secret wifi
      password: !secret wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "D1-Mini-Speaker Fallback Hotspot"
    password: "xxxxxxxxxxxx"

captive_portal:

uart:
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600

dfplayer:
  on_finished_playback:
    then:
      logger.log: 'Playback finished event'

api:
  services:
  - service: dfplayer_next
    then:
      - dfplayer.play_next:
  - service: dfplayer_previous
    then:
      - dfplayer.play_previous:
  - service: dfplayer_play
    variables:
      file: int
    then:
      - dfplayer.play: !lambda 'return file;'
  - service: dfplayer_play_loop
    variables:
      file: int
      loop_: bool
    then:
      - dfplayer.play:
          file: !lambda 'return file;'
          loop: !lambda 'return loop_;'
  - service: dfplayer_play_folder
    variables:
      folder: int
      file: int
    then:
      - dfplayer.play_folder:
          folder: !lambda 'return folder;'
          file: !lambda 'return file;'

  - service: dfplayer_play_loop_folder
    variables:
      folder: int
    then:
      - dfplayer.play_folder:
          folder: !lambda 'return folder;'
          loop: true

  - service: dfplayer_set_device_tf
    then:
      - dfplayer.set_device: TF_CARD

  - service: dfplayer_set_device_usb
    then:
      - dfplayer.set_device: USB

  - service: dfplayer_set_volume
    variables:
      volume: int
    then:
      - dfplayer.set_volume: !lambda 'return volume;'
  - service: dfplayer_set_eq
    variables:
      preset: int
    then:
      - dfplayer.set_eq: !lambda 'return static_cast<dfplayer::EqPreset>(preset);'

  - service: dfplayer_sleep
    then:
      - dfplayer.sleep

  - service: dfplayer_reset
    then:
      - dfplayer.reset

  - service: dfplayer_start
    then:
      - dfplayer.start

  - service: dfplayer_pause
    then:
      - dfplayer.pause

  - service: dfplayer_stop
    then:
      - dfplayer.stop

  - service: dfplayer_random
    then:
      - dfplayer.random

  - service: dfplayer_volume_up
    then:
      - dfplayer.volume_up

  - service: dfplayer_volume_down
    then:
      - dfplayer.volume_down

I used this text to speach site to create the announcements which are saved in mp3 format and placed on a micro SD card in the DF-Player module.

The sounds are then played in automations using:

service: esphome.d1_mini_speaker_dfplayer_play
data:
  file: 1

I’ve seated the DFPlayer above the D1 Mini as shown in the pictures below:


This makes a very compact and cheap audio announcer.

3 Likes

Thanks for the suggestion.

I’d still love to work out something with the ESP32-Audio-Kit because the single board and the built-in headphone port (to connect to powered speakers) are a big plus in my book.

But your setup will make a good interim solution, especially as I have a bunch of D1’s languishing in drawers!

1 Like

These boards look excellent, or at least interesting!

Any comment on the audio quality, both for the mics and the output quality. They look a possibility for a voice control satellite :slight_smile:

As I know esp32s not yet supported. but I think that soon they will add and your board is very good. df player and esp32 I use it quite successfully. you can see on the photo




2 Likes

Yes it is.

Digressing, but I just plug a cheapo bluetooth speaker with line-in to the line-out of one of my RPI’s.
Seem economical and probably simple on HAOS (managing my RPI myself, so a tad more tricky).

Just wondering who might do those complains :thinking:

I agree that there is still no solution for a smart speaker for a home assistant… I would really like to have their components and program code esphome could assemble the speaker smart

check this:

Have the same board and flashed it with Squeezelite and control it with LMS

GitHub - sle118/squeezelite-esp32: squeezelite ported to esp32.

1 Like

I was just coming to add that!

Thanks. This sounds like a good possible solution.

Just to clarify, assuming that by “same board” you meant the ESP32 Audio Kit (and not the Wemos D1 Mini)? Guessing so since it’s Squeezelite for ESP32, but figured I’d confirm before I dive in.

His link points to it implemented on the board you were proposing :slight_smile:

I’m also a new owner of the ESP32 Audio Kit (i ordered just for fun). I wait untill someone have a good guide (I prefer with esphome or/and stream sound?).

Just received the ESP32-Audio-Kit. I ordered it after this post clued me in on there existence. And it peeked my interest.

Some good guides for the board:
https://forums.slimdevices.com/showthread.php?116009-Squeezelite-esp32-on-ESP32-Audio-Kit-v2-2-Rotary-Encoder-SSD1322-Screen-2-keys
And

After reading both guides. I had the board up and running in 10 min’s

Hope it helps.

3 Likes

When using Squeezelite on these ESP32 Audio Kits, does it show up as a media device in home assistant? I’m looking for a easy way to create a local speaker that can play the Nabu Casa TTS. Seems like they might include it in ESPHome at some point but until then I would like to find another solution.

I haven’t gotten that far yet.
However the LMS addon (GitHub - pssc/ha-addon-lms: Logitech Media Server Addon for Home Assistant) and the esp32 plugin for LMS do see the audio kit as a player. So…

Next weekend I’ll have time to play with the Squeezelite addon. (GitHub - pssc/ha-addon-squeezelite: Squeezelite Player Addon for Home Assistant, for use with a Logitech Media Server)

On a side note. After browsing the Esphome git repository, there appears to be positive movement on the audio front.

Edit: I happened upon a 3d printable encloser for the board. (GitHub - thomaspreece/ESP32-A1S_Squeezebox_Case: A 3D printable case for an ESP-A1S running Squeezebox)

squeezelite devices appear as media players in HA. See Logitech Squeezebox - Home Assistant

Will I only need the Squeezelite firmware for the ESP32 and then the Home Assistant Squeezebox integration? I wasn’t sure if the Logitech Media Server was also needed.