Building My Own ESP32 Voice Assistant – Part 3: Connecting to Home Assistant (and Freezing the Raspberry Pi)
This is part 3 of an ongoing series in which I build my own ESP32 voice assistant. I add new parts as the components arrive and the project moves forward.
In Part 2 the microphone and the "Hey Jarvis" wake word worked on a breadboard. The speaker and the amplifier were still on the way. But I did not want to wait: even without a speaker I could connect the device to Home Assistant and try a real voice command. Home Assistant could not answer out loud, but it could carry out the command.
For the test I picked the air purifier in the living room: "Hey Jarvis, turn on the air purifier."
This part did not go as planned. That is probably why it became the most instructive one.
1. Voice assistant support on the ESP32
I added the voice_assistant component to the test firmware (mic-test.yaml). When "Hey Jarvis" is detected, it streams my speech to Home Assistant and logs the recognized command and Home Assistant's answer:
micro_wake_word:
on_wake_word_detected:
- voice_assistant.start:
wake_word: !lambda return wake_word;
voice_assistant:
id: va
microphone:
microphone: mic
on_stt_end:
- logger.log:
format: "Anlaşılan komut: %s" # "Recognized command"
args: ["x.c_str()"]
on_tts_start:
- logger.log:
format: "Home Assistant yanıtı: %s" # "Home Assistant answer"
args: ["x.c_str()"]
After flashing, Home Assistant discovered the device on its own. One click and it was added:

My Home Assistant interface is in Turkish, so the screenshots in this series are too. I describe what each one shows.
2. An alias for the air purifier
My Home Assistant assistant was set to English, but the air purifier's name is "Hava Temizleyici Air Purifier" ("hava temizleyici" is Turkish for air purifier). To make the command match easily, I gave the device the alias "air purifier" (Settings → Voice assistants → Expose):

3. Surprise: there was no speech-to-text engine
When I opened the assistant's settings, I saw that speech-to-text (STT) was set to "None". So my Home Assistant had never been able to turn speech into text. Before any voice command could work, I needed an STT engine.
I picked Home Assistant's official Whisper add-on, because it is free and runs locally.
4. The Raspberry Pi 4 froze. Twice.
I installed and started Whisper. For English, the add-on automatically started downloading the parakeet-tdt-0.6b model, about 600 MB. After a while this message appeared in the browser:
Connection lost. Reconnecting...
And Home Assistant never came back. The Raspberry Pi had stopped responding completely, and I had to unplug it and plug it back in.
My first guess was that the model was too heavy for the Pi. As soon as the Pi was back up, I stopped Whisper and changed its settings:
- Speech-to-text library: Before:
auto(picked Parakeet); After:faster-whisper - Model: Before:
auto; After:tiny-int8(the smallest model)
I restarted Whisper and the Pi froze again. Again I had to unplug it.
What I knew:
- Raspberry Pi 4, 4 GB RAM, official Raspberry Pi power supply. So I did not expect a memory or power problem.
- No error in the Whisper log. The Pi freezes the moment the model starts loading (right after the discovery: starting line).
- Other add-ons run on the same Pi: Matter, Zigbee/Thread, MQTT.
I have not found the exact cause yet. A slow SD card, heat, or memory contention with the other add-ons are all possible, and I will look into them later in the series. But the lesson is clear: running local speech recognition on a Pi 4 next to other add-ons is risky. I removed the Whisper add-on from the Pi completely, together with its half-downloaded models.
5. The fix: run Whisper on the Mac
I left Home Assistant on the Pi and moved only the speech recognition to a more powerful computer. Whisper talks to Home Assistant over the Wyoming protocol, which works over the network. So Whisper can run on another machine and Home Assistant connects to it:
ESP32 (microphone) → Home Assistant on the Pi → Whisper on the Mac → text back to the Pi → air purifier turns on
On the Mac (M1 Pro) I installed wyoming-faster-whisper in a Python virtual environment and started it with:
python -m wyoming_faster_whisper \
--uri tcp://0.0.0.0:10300 \
--zeroconf mac-whisper \
--model small-int8 \
--stt-library faster-whisper \
--language en \
--data-dir ./data
Normally --zeroconf lets Home Assistant find Whisper on the network by itself. On my Mac this announcement was blocked by macOS's local network restrictions. So I added the Wyoming Protocol integration to Home Assistant by hand (host: the Mac's IP address, port: 10300):

Then I set the assistant's speech-to-text to faster-whisper:

The downside: voice commands only work while the Mac is on. Fine for a test, but I would need another solution for daily use.
6. Three last obstacles
I thought everything was ready, but the first tries still failed. With Home Assistant's Debug view (Settings → Voice assistants → ⋮ → Debug) and the ESP32's serial log, I found three separate problems:
1. There was no text-to-speech (TTS) engine either.
the pipeline does not support text-to-speech
Even without a speaker, the ESP32 asks for a spoken answer. The assistant's TTS was also set to "None", so Home Assistant rejected the request right away. Selecting the already installed Google Translate TTS fixed it.
2. A Python package version mismatch.
speech-to-text failed (stt-stream-failed)
The audio reached Whisper on the Mac but could not be transcribed. Whisper's log showed why: faster-whisper used a parameter that was removed in the newest version (19) of the av package. Downgrading av to 18.1 fixed it:
pip install --only-binary=:all: "av==18.*"
3. Speaking too early.
No API client connected
Every time the ESP32 restarts, it takes about 20 seconds to connect to Wi-Fi and Home Assistant. If I say "Hey Jarvis" during that time, the command has nowhere to go. The fix is simple: wait until it is connected.
7. Visual feedback with the LED
Without a speaker it was hard to tell whether the device had heard me. I turned the GPIO2 LED on the ESP32 DevKit V1 into a status light:
- "Hey Jarvis" detected: the LED blinks fast.
- Home Assistant is listening: the LED stays on.
-
Command finished: the LED turns off.
output: - platform: gpio pin: GPIO2 id: dahili_led # "built-in LED"
light: - platform: binary id: durum_led # "status LED" output: dahili_led effects: - strobe: name: "Hizli Yanip Sonme" # "Fast blink" colors: - state: true duration: 80ms - state: false duration: 80ms
My first version had a small bug: when the assistant could not start (while not connected to Home Assistant), the LED got stuck blinking. I fixed it with a check that turns the LED off if the assistant has not started within 3 seconds.
Note: the red LED on the board is the power light and cannot be controlled by software.
8. Result: "Hey Jarvis, turn on the air purifier" 🎉
And finally it worked. I turned the air purifier on and off with my voice:

From the ESP32 log (the Turkish labels mean "wake word detected", "recognized command" and "Home Assistant answer"):
[22:21:41] Uyandırma kelimesi algılandı: Hey Jarvis
[22:21:48] Anlaşılan komut: Turn on the air purifier.
[22:21:48] Home Assistant yanıtı: Turned on the fan
...
[22:24:35] Uyandırma kelimesi algılandı: Hey Jarvis
[22:24:39] Anlaşılan komut: Turn off the air purifier.
[22:24:40] Home Assistant yanıtı: Turned off the fan
- Tries: 6
- Successful: 5
- Speech to text (Mac,
small-int8): ~0.85 s - Understanding the command (Home Assistant): ~0.27 s
- From end of speech to the device turning on: ~1.2 s
In the one failed try, Whisper heard "ear pro 5" instead of "air purifier". Home Assistant, quite rightly, could not find a device with that name. 😄 The microphone is still unsoldered on a breadboard and there is no speaker. Under these conditions I think the result is very good.
What I learned in this part
- Check your Home Assistant assistant first. Mine had neither an STT nor a TTS engine.
- The Debug view is your best friend. It shows at which stage each try stopped, and why.
- Be careful with local speech recognition on a Raspberry Pi 4. The
autosetting can pick a heavy model. My Pi froze even with the light one. - Wyoming is a flexible protocol. Speech recognition does not have to run on the same machine as Home Assistant.
- How to stop an add-on that freezes the Pi: turn off its "Start on boot" option as soon as the Pi is back up.
Next step
I did not want to depend on the Mac, and I did not want to speak English at home. I found the solution in the next part: Part 4: Jarvis Speaks Turkish (Home Assistant Cloud)
What's next?
The project is still going: connecting the amplifier and the speaker, soldering, the LED ring and the final assembly come in the next parts.
Parts of the series
📘 The whole build is also on Instructables as a 10-step guide: DIY ESP32 Voice Assistant for Home Assistant With a Custom Wake Word
Case design: ImpatientMaker (a remix of JakeB's "Voice Assist Puck"), CC BY-NC 4.0. ESPHome code: impatientmaker/esphome-voice-assist (MIT). Full credits in Part 1.