Войти

Building My Own ESP32 Voice Assistant – Part 5: "Hey Jarvis, Mop the Living Room"

B Автор Bisonar Team · 10 min · 2026-10-31

Building My Own ESP32 Voice Assistant – Part 5: "Hey Jarvis, Mop the Living Room"

This is part 5 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.

Türkçe versiyonu

In Part 4 Jarvis started speaking Turkish and could turn the air purifier on and off. Switching one device on and off is nice, but I wanted more. The hardest-working "employee" in our house is the robot vacuum. I wanted to give it jobs by voice too:

"Hey Jarvis, salonu temizle." (clean the living room) "Hey Jarvis, mutfağı paspasla." (mop the kitchen) "Hey Jarvis, süpürge dur ve şarj istasyonuna git." (vacuum, stop and go to the dock)

Sounds simple. But Home Assistant's built-in voice commands only know how to start and stop a vacuum. They do not understand "clean this room in this mode". This part is the story of how I filled that gap.

Getting to know the vacuum

Our vacuum is a Roborock Qrevo L Pro, connected to Home Assistant with the official Roborock integration. I started by looking at what Home Assistant knows about it. Three things mattered to me:

  • vacuum.qrevo_l_pro_nurten: The vacuum itself: start, stop, return to dock, send commands
  • select.qrevo_l_pro_nurten_temizleme_modu: Cleaning mode: vacuum (vacuum only), mop (mop only), vac_and_mop (both)
  • sensor.qrevo_l_pro_nurten_mevcut_oda: Current room, with the list of rooms on the vacuum's map

So the difference between "vacuum" and "mop" is a single setting: the cleaning mode.

The rooms' hidden numbers

In the Roborock app you give rooms names: living room, kitchen, bathroom... But inside, the vacuum knows rooms by number (segment ID), not by name. To clean a specific room you need that number.

The roborock.get_maps action of Home Assistant's Roborock integration returns these numbers. I ran it and got:

{"rooms": {"1": "Çocuk odasını", "2": "Mutfak", "3": "Yatak Odası",
           "5": "Salon", "6": "Koridor", "7": "Banyo"}}

(Kids' room, kitchen, bedroom, living room, hallway, bathroom.)

Two details caught my eye. Number 4 is missing, probably an old room deleted from the map. And in the app, the kids' room had accidentally been saved as "Çocuk odasını", a grammatically inflected form of the name. 😄 Luckily the numbers matter, not the names.

The idea: catch the sentence, extract the room

Home Assistant automations have a conversation trigger. It runs the automation when a certain sentence is spoken. The best part: you can put a wildcard like {oda} ("room") inside the sentence:

- trigger: conversation
  id: paspas            # "mop"
  command:
    - "{oda} (paspasla|paspas yap|paspas at|paspas çek)"

When I say "Salonu paspas yap" (mop the living room), {oda} becomes "Salonu". The words separated by | inside the parentheses are alternatives: "paspasla", "paspas yap", "paspas at" are all the same command.

Turkish suffixes

This is where Turkish made things a bit harder. In English the room name stays the same in a sentence: "clean the kitchen". In Turkish it takes a suffix:

  • Salon (living room): Salonu
  • Mutfak (kitchen): Mutfağı (k → ğ!)
  • Yatak odası (bedroom): Yatak odasını
  • Banyo (bathroom): Banyoyu

Instead of writing every form of every room, I chose a simpler way: look for the word stem. If the spoken phrase contains "salon", it is the living room; if it contains "mutfa", it is the kitchen. I search for "mutfa" rather than "mutfak" because of the k → ğ softening. This way both "mutfak" and "mutfağı" match.

{% set t = trigger.slots.oda | lower %}
{% set m = {'çocuk':1,'cocuk':1,'mutfa':2,'yatak':3,'salon':5,'koridor':6,'banyo':7} %}
{% set ns = namespace(s=[]) %}
{% for k, v in m.items() if k in t and v not in ns.s %}{% set ns.s = ns.s + [v] %}{% endfor %}
{{ ns.s }}

This approach had a nice side effect: multiple rooms work automatically. "Salonu ve mutfağı temizle" (clean the living room and the kitchen) → [2, 5].

I first tested this pattern without touching the robot:

  • Salonu: 5
  • Mutfağı: 2
  • Yatak odasını: 3
  • Çocuk odasını: 1
  • Koridoru: 6
  • Banyoyu: 7
  • salonu ve mutfağı: 2, 5
  • garajı (the garage): (empty: "I did not understand which room to clean")

Giving the vacuum a job

With the rooms known, two steps remain:

  1. Set the mode: vacuum for "temizle/süpür" (clean/vacuum), mop for "paspasla" (mop).
  2. Clean the rooms: Roborock's app_segment_clean command.

    • action: select.select_option target: entity_id: select.qrevo_l_pro_nurten_temizleme_modu data: option: mop
    • delay: seconds: 2
    • action: vacuum.send_command target: entity_id: vacuum.qrevo_l_pro_nurten data: command: app_segment_clean params:
      • segments: "{{ segments }}" repeat: 1
    • set_conversation_response: "{{ oda_adlari }} paspaslanıyor" # " being mopped"

The 2-second delay is deliberate. The mode setting goes to the cloud and from there to the vacuum. If the cleaning command arrives before the mode, the vacuum might start in the old mode.

set_conversation_response is Jarvis's answer: "Salon paspaslanıyor" (the living room is being mopped). Once the speaker is connected, I will hear it in the voice of Ahmet, the Turkish cloud voice.

Stop and go home

Stopping and sending it to the dock was easier, because Home Assistant has built-in actions:

  • "Süpürge dur", "Süpürgeyi durdur" (vacuum, stop): Action: vacuum.pause; Answer: Süpürge durduruldu (vacuum stopped)
  • "Süpürge dur ve şarj istasyonuna git", "Süpürgeyi şarja gönder" (go to / send to the dock): Action: vacuum.return_to_base; Answer: Süpürge şarj istasyonuna dönüyor (returning to the dock)

For "stop" I used pause instead of stop. That way I can resume from the Roborock app if I want.

I put the four triggers (vacuum, mop, stop, dock) into a single automation:

The "Robot süpürge sesli komutlar" (robot vacuum voice commands) automation in Home Assistant

The full automation: ha-config/robot-supurge-sesli.yaml

Testing without moving the robot

Home Assistant has a very useful tool: Settings → Developer tools → Assist → Sentence parser. You type a sentence and Home Assistant shows how it understands it, but does not run it. I could test the sentences without sending the robot to the living room every time:

The sentence parser: "Salonu ve mutfağı paspas yap" matched the automation

I tried 12 sentences, and all of them went to the right place. I also checked one thing on purpose: "Hava temizleyiciyi aç" (turn on the air purifier) still goes to Home Assistant's built-in command. The new automation did not break the old commands.

The real test

Everything was green in the parser. Time for the real thing. I said "Hey Jarvis" and gave the voice commands. In Home Assistant's history I could follow what happened step by step:

  • 00:23:21: "Koridoru temizle." (clean the hallway) → Jarvis: "Koridor süpürülüyor" (vacuuming the hallway)
  • 00:23:25: Cleaning mode vac_and_mop → vacuum
  • 00:23:29: The vacuum left the dock, state: cleaning
  • 00:24:01: Current room: Koridor (hallway) ✅
  • 00:24:12: "Süpürge dur ve şarj istasyonuna git." → "Süpürge şarj istasyonuna dönüyor"
  • 00:24:57: State: docked ✅

The vacuum went to the right room in the right mode and came home on command. 🎉

But not everything worked the first time

In the same test, two sentences were not understood:

"Dur ve şarj istasyonuna geri dön." (stop and go back to the dock) → Sorry, I couldn't understand that. "Süpürge dur ve şarj istasyonuna geri dön." → Sorry, I couldn't understand that.

My patterns did not include the word "geri" ("back"). I had imagined "go to the dock", but speaking naturally I had said "go back". And in the first sentence I had not said "süpürge" (vacuum) at all.

This is a classic lesson when building a voice assistant: people do not say the sentence you planned; they say whatever comes to mind. I widened the pattern:

# Before
- "[robot] süpürge[yi] [dur [ve]] (şarja|şarj istasyonuna|istasyona|üssüne|eve) (git|dön|gönder)"
# After: "süpürge" is optional, "geri" (back) added
- "[[robot] süpürge[yi]] [dur [ve]] (şarja|şarj istasyonuna|istasyona|üssüne) [geri] (git|dön|gönder)"

Square brackets [...] mean "may or may not be said". Now "Şarja dön", "Süpürge dur ve şarj istasyonuna geri dön" and "Süpürgeyi şarja gönder" all go to the same place.

I noticed one more thing: when the vacuum returned to the dock, it switched the cleaning mode back to the old one (vac_and_mop) on its own. That is not a problem for me, because the automation sets the mode again on every command.

The real problem: Jarvis did not understand my accent

The commands worked, but one thing annoyed me: I often had to say "Hey Jarvis" two or three times.

The wake word is detected on the ESP32 by a small AI model. At every moment, the model answers the question "is this Hey Jarvis?" with a probability. If the average of the last few values passes a threshold, the device wakes up. The default threshold of the hey_jarvis model is 97%.

When I looked at the logs from Part 2 again, I saw it: the average of my successful tries was always 0.97–0.98, just above the threshold. The missed ones were most likely just below it.

To confirm my suspicion I ran a simple experiment: I typed "Hey Jarvis" into Google Translate and played it from my phone's speaker. Jarvis woke up instantly. The microphone and the model were fine. The problem was my accent. The model was mostly trained on English pronunciation. Google's synthetic voice is very close to it; my "Hey Jarvis" is a bit further away.

First try: turn up the volume (it did not work)

The microphone picked up sound quite quietly, −45…−51 dB in silence. My first idea was to amplify the audio going to the model 4 times (+12 dB):

micro_wake_word:
  microphone:
    microphone: mic
    gain_factor: 4

Result: no detections at all. When you amplify the sound, the background noise is amplified by the same amount, and the loudest parts of speech get clipped and distorted. I reverted it.

Second try: lower the threshold

I lowered the threshold to 90%. To avoid reflashing the ESP32 every time, I made it a setting that can be changed from Home Assistant:

select:
  - platform: template
    name: "Uyandırma hassasiyeti"      # "Wake sensitivity"
    optimistic: true
    restore_value: true
    options:
      - "Normal (%97)"
      - "Hassas (%90)"                 # "Sensitive"
      - "Çok hassas (%80)"             # "Very sensitive"
    initial_option: "Hassas (%90)"
    on_value:
      - lambda: |-
          if (x == "Normal (%97)") id(hey_jarvis).set_probability_cutoff(247);
          else if (x == "Hassas (%90)") id(hey_jarvis).set_probability_cutoff(230);
          else id(hey_jarvis).set_probability_cutoff(204);

The threshold is given as a number from 0 to 255: 247/255 ≈ 97%, 230/255 ≈ 90%.

Result:

  • 1: Average probability: 0.95; With 97% threshold: ❌; With 90% threshold: ✅
  • 2: Average probability: 0.90; With 97% threshold: ❌; With 90% threshold: ✅
  • 3: Average probability: 0.95; With 97% threshold: ❌; With 90% threshold: ✅
  • 4: Average probability: 0.91; With 97% threshold: ❌; With 90% threshold: ✅
  • 5: Average probability: 0.96; With 97% threshold: ❌; With 90% threshold: ✅

All five tries were detected. With the old threshold, all five would have been missed. Jarvis now heard me the first time.

Lowering the threshold has a price: the device may wake up by mistake on similar sounds, for example from the TV. In my short tests I did not see that at 90%. But I found the real solution in the next part: changing the word altogether.

What I learned in this part

  • When the built-in commands are not enough, the conversation trigger steps in. You can write your own sentences and your own logic.
  • The easy way to handle Turkish suffixes is the word stem. Instead of writing every suffix combination, searching for stems like "salon" or "mutfa" is enough.
  • Learn your device's hidden numbers. Roborock knows rooms by number, not by name, and roborock.get_maps gives you those numbers.
  • Test with the sentence parser without wearing out the robot.

Next step

Lowering the threshold worked, but using a word someone else had picked still did not feel right. In the next part I give my assistant its own name: Part 6: "Hello Bex", Training My Own Wake Word

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.

AI Automationn8nBusiness
Поделиться:
← Все статьи