Enhancing Voice Assistant: Integrate an External Speaker using ESPHome

Enhancing Voice Assistant: Integrate an External Speaker using ESPHome

Did you know you can easily integrate an external Smart Speaker with your voice assistant using ESPHome? In this video, we’ll show you how to use ESPHome to connect your M5Stack Atom Echo or ESP32 S3 Box to your Home Assistant setup. Enhance your voice assistant experience with a better sound quality today!

NOTE:
Changing the i2s_dout_pin: GPIO22 to i2s_dout_pin: GPIO21 in the speaker: section stops the Atom Echo internal speaker from playing as well. Thanks @revilo819!

⭐ You can download the code that I created for this video at: https://ko-fi.com/s/1175278343 ⭐

Links referred to in this video:
* How to set up Voice Assistants / What’s New in Home Assistant May 2023.5? Voice, Voice, and Voice!: https://youtu.be/nh3jnPGAtMI
* Local Voice Assistance with Wake Word in Home Assistant – Bye bye Alexa and Google Home: https://youtu.be/VAFDgib95Ls
* Firmware file for M5Stack Atom Echo: https://github.com/esphome/firmware/blob/main/voice-assistant/m5stack-atom-echo.yaml
* Firmware (list) for ESP32 S3 Box Models: https://github.com/esphome/firmware/tree/main/voice-assistant

Blog version: https://www.smarthomejunkie.net/enhancing-voice-assistant-integrate-an-external-speaker-using-esphome

⭐⭐⭐
* Join this channel to get access to perks: 📺 https://www.youtube.com/c/smarthomejunkie/join
* Please consider becoming my patron 🏅 at https://www.patreon.com/join/smarthomejunkie
* Or please support me by buying me a ☕ at https://ko-fi.com/smarthomejunkie/
⭐⭐⭐

⭐ If you want me to create a review of your product, please visit this page for information and rates: https://www.smarthomejunkie.net/review-and-advertisement-information/ ⭐

My Devices: https://github.com/smarthomejunkie/MyDevices

Instagram: https://www.instagram.com/smarthomejunkie/
X: https://www.x.com/smarth0mejunkie
Mastodon: https://mastodon.world/@smarthomejunkie
Facebook: https://www.facebook.com/smarthomejunkie/
TikTok: https://www.tiktok.com/@smarthomejunkie
Discord: https://discord.gg/at8v5hW

Music by:
* 2TECH-AUDIO: https://2tech-audio.bandcamp.com/

00:00:00 Introduction
00:01:54 Updating the code for the Atom Echo
00:03:00 Selecting your Smart Speaker
00:05:14 Installing the new firmware for the Voice Assistant
00:06:30 Making sure that the ESPHome device may invoke services in Home Assistant
00:07:02 Testing the Voice Assistant response using a smart speaker

#homeassistant #tutorial #voiceassistant #voicecontrol #ESPHome #externalspeaker #smarthome #smarthomesolutions #homeautomation #technology #homeimprovement #smartdevices #homeintegration #smartliving #smarthometechnology #intelligenthome #hometech #automatedhome #smarttechnology #connectedhome #homeinnovation #smartgadgets #homeentertainment

50 Comments

  1. @JaredWhitlow on December 31, 2024 at 6:13 pm

    Anyone get this to work with an amazon echo speaker?

  2. @StaffordBully on December 31, 2024 at 6:13 pm

    I bought your code because it didn’t work, but now still the same, cant get it working, installation keeps loading

  3. @darrenorange2982 on December 31, 2024 at 6:15 pm

    Will this work offline?

  4. @AntoineIsi on December 31, 2024 at 6:15 pm

    Hello, it’s possible to do that with a s3box ?

  5. @photelegy on December 31, 2024 at 6:18 pm

    ❓ 7:00
    After the install of the new firmware it doesn’t work anymore.
    Could this be because the firmware on Github looks a bit different than yours. (I used m5stack-atom-echo.yaml and there is also m5stack-atom-echo.adopted.yaml, would this be better?)

    Do you have an idea what the problem could be?

  6. @homeyoutube8232 on December 31, 2024 at 6:19 pm

    Hi Junkie!

    In your video, at 06:40, the overwritten previous adoptable item is visible on the top left of the HA screen with a green tick at the top. How can this be permanently deleted from here?

  7. @jeanlucderdritte on December 31, 2024 at 6:20 pm

    1stly, thanks @SmartHomeJunkie this worked like a charm. I had to do some tweaking, like make sure I have the right Secrets safed in ESP home confic secrets for my WiFi.

    I have one ask to the world 🙂 Any Idea how I can change the volume of my Smart speaker? Normally I have very quiet background music running so the response of my Voice Asssistant is very silent. So in an ideal scenario I would save the current volume somewhere. Stop the speaker, increase the volume to 0.4. speak the response from the VoiceAssist and return to the original volume and continue the playback. Does anyone have an idea? Thanks!

  8. @CraigTinson2015 on December 31, 2024 at 6:21 pm

    I found this and it led me in the right direction to change mine to use my wallpanels speaker.. so thanks! I see the issue of muting the echo speaker has been resolved but I can’t figure out how to do the same with the bos-s3.. any hints? and thanks again!

  9. @joedirt6699 on December 31, 2024 at 6:21 pm

    has anyone been able to make this work with a homepod as the external speaker?

  10. @MarcelvanDorp-mr3gv on December 31, 2024 at 6:21 pm

    If you don’t mind the internal speaker of the echo still active (or just cut the wires:), then you can just use the default config, with the on_tts_end part added to it (under the voice_assistant: key).

    If you save and use the validate button, you’ll see all the code, with the on_tts_ends part added, just what is needed.

    I did a cosmetic enhancement as well: Under the substitution: key I added external_media_player_id: media_player.sonos_move, and in the on_tts_end I use this as media_player: ${external_media_player_id}

    With this enhancement the added code is static, and only the substitutions need to be configured. I believe updates to the atom echo code is also honored, as long as it doesn’t involve the on_tts_end automation…but then again: if this is added in the official code, then probably this solution isn’t needed anymore 🙂

    Unfortunately I don’t know a way to use this same trick to overwrite or delete the speaker: configuration to disable it. AFAIK, this only works with additions, not with changes or deletions

  11. @JussAren812 on December 31, 2024 at 6:22 pm

    you sir is a genius. thank you.

  12. @stang70man on December 31, 2024 at 6:22 pm

    Thanks!😀

  13. @Mohicano505 on December 31, 2024 at 6:24 pm

    Just a question, i don’t get the reason to use an alexa or google home speaker if the purpose was to have a better privacy? What is the difference just using the echo integrsted to ha ussing nabucasa? Am i missing something?

  14. @threepe0 on December 31, 2024 at 6:28 pm

    To disable the local speaker, change the GPIO pin for the speaker.

  15. @johnhubbard3879 on December 31, 2024 at 6:28 pm

    Thanks Ed! I was able to use this tutorial to add my Sonos Amp Speakers in my ceiling to my Esp32 S3 Box 3 and it works great. I saw the comments regarding removing the response from the Atom Echo speaker, but is there a way to do something similar for the Box 3? The echoed response is definitely annoying haha.

  16. @AlexandreOuicher on December 31, 2024 at 6:29 pm

    Toi avoid sound on atom speaker, you have to comment "speaker"

    voice_assistant:
    id: va
    microphone: echo_microphone
    #speaker: echo_speaker

    And

    to avoid buffer memory problem, don’t use on_tts_end but, like this…

    on_tts_start:
    – light.turn_on:
    id: led
    blue: 100%
    red: 0%
    green: 0%
    brightness: 100%
    effect: none
    – homeassistant.service:
    service: tts.google_cloud_say
    data:
    entity_id: media_player.salon
    data_template:
    message: "{{ my_stt }}"
    variables:
    my_stt: return x;

  17. @parkeonable on December 31, 2024 at 6:31 pm

    I love your videos ! I try to follow your tutorial using an M5 atom echo, but unfortunately I failed ! My home assistant server is on a Generic x86-64 platform (Z83II with 4GB ram) and it seems that the code failed to compile. Home assistant reboot. Is it a matter of my plateform (first time I have this kind of issue) or any changes on ESPhome framework that make this m5stack-atom-echo.yaml file unusable ?

  18. @marcelw.4779 on December 31, 2024 at 6:35 pm

    Spent some hours on this, got it to work for a couple of times but then the M5 Echo just stopped recognizing the wake word. Very frustrating experience

  19. @berwickcomputers on December 31, 2024 at 6:35 pm

    I have a question, could this device be used as a chime for security camera alerts. As in reolink integration people/vehicle detection send a tone or beep or TTS to the atom

  20. @steffenlenk1656 on December 31, 2024 at 6:35 pm

    The video was exactly what I was looking for. Unfortunately it didn’t work for me because I got the following error during installation: “esp_image: Image length 1836240 doesn’t fit in partition length 1835008”. But this error is known (M5 Stack Atom Echo VA firmware does not install locally since a79c9fa – image too big. #227) and I hope that since I don’t know how to do the workaround, I guess I’ll have to wait for the fix. But thank you very much for this good explanation

  21. @kloakovalimonada on December 31, 2024 at 6:38 pm

    can’t get this to work. it compiles without issues but never connects to wifi. The yaml is correct, I quadruple checked (not my first ESPHome device), I do NOT have duplicate wifi entries or extra spaces, nothing like that. Not a DHCP conflict either. If I flash it as a binary ESPHome Web, it finishes, I see it on the network via LanScan, but ESPHome never picks it up.

    The default I was able to make work, this mod, no.

    just
    ERROR Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname

  22. @tylerrydell on December 31, 2024 at 6:39 pm

    I found that I couldn’t outright disable the speaker to stop the audio because parts of the code require a speaker to be defined in order to compile. I did, however, stop the atom echo from playing any audio by breaking its config, like pointing the pin to something other than the correct pin, like GPIO21. That way, the code will still compile and install, the speaker won’t output audio, and your HA media_player will play audio instead.

  23. @photelegy on December 31, 2024 at 6:39 pm

    1:40
    Instuctions unclear:
    1. Watched the recommended video "Trash it!" and then trashed my Google Home Mini
    2. Went back to this video and now need to buy a new Google Home Mini?
    😅😂😂😂😉

  24. @SmartHomeJunkie on December 31, 2024 at 6:40 pm

    ⭐ You can download the code that I created for this video at: https://ko-fi.com/s/1175278343

    And the winner is @revilo819! Changing the i2s_dout_pin: GPIO22 to i2s_dout_pin: GPIO21 in the speaker: section stops the Atom Echo internal speaker from playing as well.

  25. @laurens2382 on December 31, 2024 at 6:42 pm

    Does it work with a sonos aswell? Cant get it to work for some reason

  26. @Polika270 on December 31, 2024 at 6:43 pm

    in ‘on_tts_start’ section add " – speaker.volume_set: 10%" viola no atom "ECHO" 🙂 and no filling the i2s buffer (misconfiguring i2s method) Working 🙂

  27. @innycoc8617 on December 31, 2024 at 6:45 pm

    I haven’t seen how to do this in s3-box-3, there is no on_tts_start in the code

  28. @VieViuR89 on December 31, 2024 at 6:46 pm

    Done everything even typed ssid and pw into secrets.yaml – no luck atom discoverbale with no response at all just bright white light, another time atom went completely offline… I regret spending 3usd on that… unfortunately in Polish language there’s still no alternative no good voice assistant…

  29. @nitroedge on December 31, 2024 at 6:46 pm

    Quick question, I have edited the YAML in ESPHome (inside the HA Add-on), I then did the install to my S3 box…. when I make changes to the YAML in the ESPHome add-on, and click Save. Is that sufficient to test out changes? For example, I have added the tts_end code you described…. if I change other things in there and click save, I don’t need to create a new firmware file and install it do I?

  30. @mstemmer4573 on December 31, 2024 at 6:46 pm

    Hi! Is it possible to adopt the pre-installed version without connection to the HA-device but through ESPHOME web via another device?

  31. @FrenkyvanDodewaard on December 31, 2024 at 6:47 pm

    Could this also be done via a bluetooth speaker?

  32. @andrewwaldram3309 on December 31, 2024 at 6:47 pm

    in ‘on_tts_start’ section add " – speaker.volume_set: 10%" viola no atom "ECHO" 🙂 and no filling the i2s buffer (misconfiguring i2s method)

  33. @MrTedJourney on December 31, 2024 at 6:47 pm

    Surely to mute the speaker in Atom Echo…its speaker wire…scissors……snip!

  34. @cheesestixx on December 31, 2024 at 6:50 pm

    This would be super impressive if it’s real, but it would be great if you explain that you want money for it, first, and stop calling it a "donation" if it’s required.
    That’s a fee, not a "donation"
    There’s also no way to pay your "donation" from many countries, because whatever payment service you’re using is pretty weird.
    I hope this is real, it looks great, but 🤷

  35. @dankkster on December 31, 2024 at 6:50 pm

    this does not work for alexa/echo speakers it looks like. unless the config is different for that?

  36. @AntonioBrandao on December 31, 2024 at 6:52 pm

    Isn’t it possible to use the PCB connector to add a better speaker to the ESP S3?

  37. @MarcelvanDorp-mr3gv on December 31, 2024 at 6:53 pm

    I tried this with a Sonos move 2, which honors the "announce" option. But if I use a group, then the music stops and the announcement is played, but the music is not resumed!
    Could be an issue with my group config, of course, haven’t investigated it yet

  38. @craigmcfarlane5686 on December 31, 2024 at 6:53 pm

    How can i use the code with an Amazon Alexa?

  39. @MrWizardGG on December 31, 2024 at 6:57 pm

    What a badass

  40. @stang70man on December 31, 2024 at 6:57 pm

    Once again, you’ve rescued me from some small amount of pain! I had a speaker that quit announcing for some strange reason and I remembered this video. While working on it, I realized I have two atom speakers that I could tie to a local media player and have made both of them much easier to hear in their respective rooms. Thank you!

  41. @fins5150 on December 31, 2024 at 6:58 pm

    Hi, I’ve been at this for two days trying to figure out why. I get M5 to install, but the M5 will not play on Google Mini’s. M5 will do what’s told, but no voice… Original setup from $13 voice assistant for HA page works fine. All code seems correct. Anyone run into this?

  42. @homeyoutube8232 on December 31, 2024 at 6:59 pm

    Hello!
    I have a Google Nest Hub display speaker available. When the answering sound is heard, I would like to display a picture on the screen, or if this is not possible, then just dim the screen for the duration of the answer. Is there such a solution?

  43. @8BitLife69 on December 31, 2024 at 6:59 pm

    Surely you can disable the onboard speaker of the atom echo?

    Just comment out the speaker code:

    #speaker:
    # – platform: i2s_audio
    # id: echo_speaker
    # i2s_dout_pin: GPIO22
    # dac_type: external
    # mode: mono

  44. @AndrzejZagorny on December 31, 2024 at 7:00 pm

    esp32-s3-box-3 No compilation occurs. I have an error: /config/esphome/esp32-s3-box-3-5aa9c0.yaml: In lambda function:
    /config/esphome/esp32-s3-box-3-5aa9c0.yaml:180:14: error: ‘x’ was not declared in this scope
    media_content_id: !lambda ‘return x;’
    ^

  45. @Evermysticdesigns on December 31, 2024 at 7:01 pm

    i have purchased your code, love your tutorials and your channel but please help me out here . spent hours trying to work out how you got access to the m6STACK key , code… etc … my setup looks nothing like that

  46. @wapphigh5250 on December 31, 2024 at 7:03 pm

    Why isn’t Nabu Casa selling a hardware with mic and speaker solution for local voice like this that simply works out of the box?! Do we even know if they are working on producing one? thanks!

  47. @NightHawkATL on December 31, 2024 at 7:05 pm

    Using a cloud-based "media player" to repeat the audio from a local voice assistant is counter-intuitive. Using a local voice assistant is the means to get away from the cloud. I am hoping to figure out support for a USB speaker/mic combo unit with my S3 box when it comes. If not, I hoe to use a bluetooth speaker/mic combo.

  48. @PeterPavlik72 on December 31, 2024 at 7:06 pm

    Audio output re-direction should be supported by the standard VoiceAssistant engine because all ESP development devices have insufficient volume/quality speakers.
    Have local MPD & Sonos media players but only use Google TTS with them because of this.
    Hope that the VA developers will remove this limitation soon…

  49. @michaelblaisdell on December 31, 2024 at 7:07 pm

    I was able to copy your code for a cup of coffee and the google speaker works – but – when I asked the assistant to set a timer for 10 mins it stated timers were not supported on the device. Any idea why timers would no longer be supported??? This was on the ESP S3 Box 3.

  50. @thedarkknight76uk on December 31, 2024 at 7:09 pm

    I tried this with my amazon echo unfortunately it doesn’t work. @smarthomejunkie is there anything I can check to see where it’s broken? It just doesn’t use my echo show for the tts.

Leave a Comment