that does also not work as well for me, can’t get a click/ping to work on my echo
I’m a rookie, but why not use a “parallel” function?
| do the sound
wake - paralell function |
| do the action you want...
Could it work?
you have to stop the voice assistant, as it occupies the speaker, I guess you cannot play a click without changing the esphome voice_assistant code: https://github.com/esphome/esphome/blob/a2e152ad1252444a9d12e3a129270f62076d4c12/esphome/components/voice_assistant/voice_assistant.h
Thanks a lot for sharing! I’m a new to HA’s Voice Assist functionality. I’m working with an onju-voice (nest mini) device, and that works just fine. For wakework detection¬ification I’m trying with this in ESPHome configuration of the onju-voice device:
on_listening:
- homeassistant.service:
service: tts.speak
target:
entity_id: tts.google_en_com
data:
media_player_entity_id: onju_out
message: "Yes?"
- light.turn_on:
id: led
blue: 100%
red: 0%
green: 0%
effect: "Slow Pulse"
Unfortunately this doesn’t work.
I would be very grateful for your kind support!
Has anyone managed to get this working, to play a sound when the wake word is detected. Any sound TTS or wav?
In the MQTT solution posted here, I don’t really get how do you play a sound on the Echo. Fine you will send a MQTT message… but then what… the Echo isn’t exposed as a media player.
I wanted to give it a try with speaker.play, but I don’t get what to put into the data field. How to convert a wav file to whatever format is needed here? I can’t find any docs
Hey,
I’m getting close to figuring this out. Instead of using ‘on_listening’ use ‘on_wake_word_detected’. I’ll just post what I have here (I’m using piper though):
on_wake_word_detected:
- switch.turn_off: use_wake_word
- delay: !lambda "if (id(use_wake_word).state) return 200; else return 0;"
- homeassistant.service:
service: tts.speak
data:
cache: "false"
media_player_entity_id: media_player.onju_1_onju_voice_1
message: What do you want?
entity_id: tts.piper
- wait_until:
not:
media_player.is_playing: onju_out
- delay: 100ms
- voice_assistant.start_continuous
I don’t like how the LEDs behave during this part, kind of glitchy.
on_end:
- delay: 100ms
- wait_until:
not:
media_player.is_playing: onju_out
- if:
condition:
switch.is_on: use_wake_word
then:
- script.execute: reset_led
else:
- delay: 100ms
- switch.turn_on: use_wake_word
Test it out for yourself and see if you can improve it!
Edit: I should have said that there is something wrong the stuff I modified for ‘on_end’ - it does restart wakeword detection, however it doesn’t actually detect the wakeword until I toggle the switch in HA. So it needs work.
Edit2: see updated code above. Might have cracked it! Not sure if this would work on other ESP32 devices running voice assistant, but please give it a try.
Wow - this works (onju voice here)!
Thanks a lot.
Again many thanks for sharing this!
I am already very happy with how it works right now. There may be one small improvement for me. After the wakeword confirmation (“What do you want?”), there is a slight delay until the device will listen. I have tried removing (one-by-one) the delays as included in your “on_wake_word_detected” configuration, but that does not seem to work.
Again, not at all a big thing.
In my case it almost works with ESP32 speaker, but with bug.
First it says “not recognized” and then the phrase “room light on” (and it does switch light).
Looks like I’ve messed with the configuration, I’d appreciate it if you could point out what’s wrong with my program.
voice_assistant:
microphone: mic_i2s
id: va
noise_suppression_level: 2
auto_gain: 31dBFS
volume_multiplier: 4.0
use_wake_word: false
media_player: media_player_speaker
on_wake_word_detected:
- light.turn_on:
id: led_light
effect: "1-Green"
brightness: 100%
- switch.turn_off: use_wake_word
- delay: !lambda "if (id(use_wake_word).state) return 200; else return 0;"
- homeassistant.service:
service: tts.speak
data:
# cache: "false"
media_player_entity_id: media_player.speaker_22_esp_speaker_1
message: Say!
entity_id: tts.piper
- wait_until:
not:
media_player.is_playing: media_player_speaker
- delay: 10ms
- voice_assistant.start_continuous
on_listening:
- light.turn_on:
id: led_light
effect: "Scan Effect"
red: 63%
green: 13%
blue: 93%
brightness: 50%
on_stt_vad_start:
- light.turn_on:
id: led_light
effect: "Scan Effect"
red: 0%
green: 100%
blue: 50%
brightness: 50%
on_stt_end:
- light.turn_on:
id: led_light
effect: "None"
red: 0%
green: 100%
blue: 0%
brightness: 50%
on_error:
- light.turn_on:
id: led_light
effect: "1-red"
brightness: 50%
- if:
condition:
switch.is_on: use_wake_word
then:
- switch.turn_off: use_wake_word
- delay: 1sec
- switch.turn_on: use_wake_word
on_client_connected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
on_client_disconnected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.stop:
on_end:
- delay: 100ms
- wait_until:
not:
media_player.is_playing: media_player_speaker
- if:
condition:
switch.is_on: use_wake_word
then:
light.turn_on:
id: led_light
effect: "1-Blue"
brightness: 100%
else:
- delay: 100ms
- switch.turn_on: use_wake_word
binary_sensor:
- platform: status
name: API Connection
id: api_connection
filters:
- delayed_on: 1s
on_press:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
on_release:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.stop:
- platform: status
name: "Status"
switch:
- platform: template
name: "Use wake word"
id: use_wake_word
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
entity_category: config
on_turn_on:
- lambda: id(va).set_use_wake_word(true);
- if:
condition:
not:
- voice_assistant.is_running
then:
- voice_assistant.start_continuous
on_turn_off:
- voice_assistant.stop
- lambda: id(va).set_use_wake_word(false);
- platform: restart
name: "Speaker 2 Restart"
It’s like there’s a loop and it’s listening for something unnecessary.
p.s. I removed the caching false line, as this is a standard phrase that will be repeated every time and it works faster. This can’t be the cause of the failure, can it?
Did anyone get this working with an Atom Echo?
Did anyone get this working? I feel like an audio cue when your wake word is detected is a really important option to have.
I have been able to get a pretty good solution based on the solution in the post from cnose, using a small sound clip instead of tts.
First you will need a audio clip, I found a collection. Download the sound clip and to convert it by running:
ffmpeg -i INPUT.mp3 -ac 1 -acodec pcm_u8 -ar 16000 wakeword-detected.wav
sox wakeword-detected.wav --bits 8 --encoding signed-integer --endian little wakeword-detected.raw
The config was updated with (just the updated/added sections is shown):
external_components:
- source: github://jesserockz/esphome-components
components: [file]
file:
- id: ok_sound
file: wakeword-detected.raw
voice_assistant:
on_wake_word_detected:
- switch.turn_on: play_wakeword_sound
- wait_until:
not:
- voice_assistant.is_running
- lambda: id(echo_speaker).play(id(ok_sound), sizeof(id(ok_sound)));
- wait_until:
not:
speaker.is_playing:
- voice_assistant.start_continuous
on_stt_end:
- if:
condition:
switch.is_on: play_wakeword_sound
then:
- switch.turn_off: play_wakeword_sound
switch:
- platform: template
name: Play Wakeword sound
id: play_wakeword_sound
optimistic: true
internal: true
restore_mode: RESTORE_DEFAULT_OFF
on_turn_on:
- voice_assistant.stop
- lambda: id(va).set_use_wake_word(false);
on_turn_off:
- delay: 5s
- lambda: id(va).set_use_wake_word(true);
- if:
condition:
not:
- voice_assistant.is_running
then:
- voice_assistant.start_continuous
Edit 1: It seems to work a bit better by adding a delay in play_wakeword_sound.on_turn_off
Edit 2: The file module was updated and argument changed from path
to file
maybe stupid question but I assume that
path: wakeword-detected.raw
should be on Atom Echo device
how do I stick it in there?
It is a path on the computer you run esphome compile
, if you have it in the same place as the yaml config file it should work as shown. The esphome compilation will read in the file and embed it in the firmware that is then uploaded to the device.
I was able to get a sound to play from the Atom Echo using your code and instructions, so thank you so much for providing those!
However, after the assist pipeline has finished, and tries to send back a voice reply, the Echo’s log fills up with “speaker buffer is full” (or something to that effect) and the voice never plays. The wake sound I’m using is about a second long and about 15kb in size when converted to .raw. Any idea on how to resolve this?
Hi, it could be the file size. My sound is 8k, so you could try reducing it and see if that helps. You could also try to add a short delay between the speaker.play
and wait_until
and before voice_assistant.start_continuous
and see if that makes a difference.
Managed to get the file down to 7kb, and it seems to play okay — unfortunately, still having an issue actually getting the playback to happen. Sometimes it starts okay, but then after finishing the response it flicks straight back into “assist mode” and flashes the lights, causing a loop.
Normally though, it hears the wake word, plays the sound, and then flashes red after my voice command has finished and struggles to play back the response.
Here’s my config, along with some error logs:
substitutions:
name: <NAME_HERE>
friendly_name: Atom Echo
packages:
m5stack.atom-echo-voice-assistant: github://esphome/firmware/voice-assistant/m5stack-atom-echo.yaml@main
esphome:
name: ${name}
name_add_mac_suffix: false
friendly_name: ${friendly_name}
api:
encryption:
key: <KEY HERE>
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
external_components:
- source: github://jesserockz/esphome-components
components: [file]
file:
- id: ok_sound
file: awake.raw
voice_assistant:
on_wake_word_detected:
- switch.turn_on: play_wakeword_sound
- wait_until:
not:
- voice_assistant.is_running
- lambda: id(echo_speaker).play(id(ok_sound), sizeof(id(ok_sound)));
- delay: 1s
- wait_until:
not:
speaker.is_playing:
- voice_assistant.start_continuous
on_stt_end:
- if:
condition:
switch.is_on: play_wakeword_sound
then:
- switch.turn_off: play_wakeword_sound
switch:
- platform: template
name: Play Wakeword sound
id: play_wakeword_sound
optimistic: true
internal: true
restore_mode: RESTORE_DEFAULT_OFF
on_turn_on:
- voice_assistant.stop
- lambda: id(va).set_use_wake_word(false);
on_turn_off:
- delay: 5s
- lambda: id(va).set_use_wake_word(true);
- if:
condition:
not:
- voice_assistant.is_running
then:
- voice_assistant.start_continuous
[17:34:45][D][voice_assistant:636]: Wake word detected
[17:34:45][D][switch:012]: 'Play Wakeword sound' Turning ON.
[17:34:45][D][switch:055]: 'Play Wakeword sound': Sending state ON
[17:34:45][D][voice_assistant:620]: Signaling stop...
[17:34:45][D][voice_assistant:504]: State changed from STREAMING_MICROPHONE to STOP_MICROPHONE
[17:34:45][D][voice_assistant:510]: Desired state set to IDLE
[17:34:45][D][voice_assistant:627]: Event Type: 3
[17:34:45][D][voice_assistant:641]: STT started
[17:34:45][D][voice_assistant:504]: State changed from STOP_MICROPHONE to STOPPING_MICROPHONE
[17:34:45][D][light:036]: 'Atom Echo' Setting:
[17:34:45][D][light:059]: Red: 0%, Green: 0%, Blue: 100%
[17:34:45][D][light:109]: Effect: 'Slow Pulse'
[17:34:45][D][esp-idf:000]: I (60569) I2S: DMA queue destroyed
[17:34:45]
[17:34:45][D][voice_assistant:504]: State changed from STOPPING_MICROPHONE to IDLE
[17:34:45][D][esp-idf:000][speaker_task]: I (60581) I2S: DMA Malloc info, datalen=blocksize=512, dma_buf_count=8
[17:34:45]
[17:34:45][D][i2s_audio.speaker:203]: Starting I2S Audio Speaker
[17:34:45][D][i2s_audio.speaker:206]: Started I2S Audio Speaker
[17:34:46][D][esp-idf:000][speaker_task]: I (60908) I2S: DMA queue destroyed
[17:34:46]
[17:34:46][D][i2s_audio.speaker:210]: Stopping I2S Audio Speaker
[17:34:46][D][i2s_audio.speaker:222]: Stopped I2S Audio Speaker
[17:34:46][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
[17:34:46][D][esp32.preferences:114]: Saving 2 preferences to flash...
[17:34:46][D][esp32.preferences:143]: Saving 2 preferences to flash: 0 cached, 2 written, 0 failed
[17:34:46][D][voice_assistant:504]: State changed from IDLE to START_MICROPHONE
[17:34:46][D][voice_assistant:510]: Desired state set to START_PIPELINE
[17:34:46][D][voice_assistant:221]: Starting Microphone
[17:34:46][D][voice_assistant:504]: State changed from START_MICROPHONE to STARTING_MICROPHONE
[17:34:46][D][esp-idf:000]: I (61586) I2S: DMA Malloc info, datalen=blocksize=1024, dma_buf_count=4
...
[17:37:51][W][i2s_audio.speaker:042]: Called start while task has been already created.
[17:37:51][W][i2s_audio.speaker:042]: Called start while task has been already created.
[17:37:51][E][voice_assistant:804]: Cannot receive audio, buffer is full
[17:37:51][W][i2s_audio.speaker:042]: Called start while task has been already created.
[17:37:51][W][i2s_audio.speaker:042]: Called start while task has been already created.
[17:37:51][W][i2s_audio.speaker:042]: Called start while task has been already created.
Tried without delay, a 0.5s and a 1s delay and currently all performing the same “assist start” > “flash red” > “fail to respond” loop.
And a full log from restarting the device, speaking the wakeword, and asking it to turn on the bedroom light (which it misheard as “battery light” )
[17:47:04][D][voice_assistant:504]: State changed from STREAMING_MICROPHONE to WAIT_FOR_VAD
[17:47:04][D][voice_assistant:510]: Desired state set to WAITING_FOR_VAD
[17:47:04][D][voice_assistant:245]: Waiting for speech...
[17:47:04][D][voice_assistant:504]: State changed from WAIT_FOR_VAD to WAITING_FOR_VAD
[17:47:04][D][voice_assistant:258]: VAD detected speech
[17:47:04][D][voice_assistant:504]: State changed from WAITING_FOR_VAD to START_PIPELINE
[17:47:04][D][voice_assistant:510]: Desired state set to STREAMING_MICROPHONE
[17:47:04][D][voice_assistant:275]: Requesting start...
[17:47:04][D][voice_assistant:504]: State changed from START_PIPELINE to STARTING_PIPELINE
[17:47:04][D][voice_assistant:525]: Client started, streaming microphone
[17:47:04][D][voice_assistant:504]: State changed from STARTING_PIPELINE to STREAMING_MICROPHONE
[17:47:04][D][voice_assistant:510]: Desired state set to STREAMING_MICROPHONE
[17:47:04][D][light:036]: 'Atom Echo' Setting:
[17:47:04][D][light:051]: Brightness: 60%
[17:47:04][D][light:059]: Red: 100%, Green: 89%, Blue: 71%
[17:47:04][D][voice_assistant:627]: Event Type: 1
[17:47:04][D][voice_assistant:630]: Assist Pipeline running
[17:47:04][D][voice_assistant:627]: Event Type: 9
[17:47:09][D][voice_assistant:627]: Event Type: 10
[17:47:09][D][voice_assistant:636]: Wake word detected
[17:47:09][D][switch:012]: 'Play Wakeword sound' Turning ON.
[17:47:09][D][switch:055]: 'Play Wakeword sound': Sending state ON
[17:47:09][D][voice_assistant:620]: Signaling stop...
[17:47:09][D][voice_assistant:504]: State changed from STREAMING_MICROPHONE to STOP_MICROPHONE
[17:47:09][D][voice_assistant:510]: Desired state set to IDLE
[17:47:09][D][voice_assistant:627]: Event Type: 3
[17:47:09][D][voice_assistant:641]: STT started
[17:47:09][D][voice_assistant:504]: State changed from STOP_MICROPHONE to STOPPING_MICROPHONE
[17:47:09][D][light:036]: 'Atom Echo' Setting:
[17:47:09][D][light:059]: Red: 0%, Green: 0%, Blue: 100%
[17:47:09][D][light:109]: Effect: 'Slow Pulse'
[17:47:09][D][esp-idf:000]: I (55511) I2S: DMA queue destroyed
[17:47:09]
[17:47:09][D][voice_assistant:504]: State changed from STOPPING_MICROPHONE to IDLE
[17:47:09][D][esp-idf:000][speaker_task]: I (55523) I2S: DMA Malloc info, datalen=blocksize=512, dma_buf_count=8
[17:47:09]
[17:47:09][D][i2s_audio.speaker:203]: Starting I2S Audio Speaker
[17:47:09][D][i2s_audio.speaker:206]: Started I2S Audio Speaker
[17:47:09][D][esp-idf:000][speaker_task]: I (55850) I2S: DMA queue destroyed
[17:47:09]
[17:47:09][D][i2s_audio.speaker:210]: Stopping I2S Audio Speaker
[17:47:09][D][i2s_audio.speaker:222]: Stopped I2S Audio Speaker
[17:47:09][D][voice_assistant:504]: State changed from IDLE to START_MICROPHONE
[17:47:09][D][voice_assistant:510]: Desired state set to START_PIPELINE
[17:47:09][D][voice_assistant:221]: Starting Microphone
[17:47:09][D][voice_assistant:504]: State changed from START_MICROPHONE to STARTING_MICROPHONE
[17:47:09][D][esp-idf:000]: I (56026) I2S: DMA Malloc info, datalen=blocksize=1024, dma_buf_count=4
[17:47:09]
[17:47:09][D][voice_assistant:504]: State changed from STARTING_MICROPHONE to START_PIPELINE
[17:47:09][D][voice_assistant:275]: Requesting start...
[17:47:09][D][voice_assistant:504]: State changed from START_PIPELINE to STARTING_PIPELINE
[17:47:09][D][voice_assistant:525]: Client started, streaming microphone
[17:47:09][D][voice_assistant:504]: State changed from STARTING_PIPELINE to STREAMING_MICROPHONE
[17:47:09][D][voice_assistant:510]: Desired state set to STREAMING_MICROPHONE
[17:47:09][D][voice_assistant:627]: Event Type: 1
[17:47:09][D][voice_assistant:630]: Assist Pipeline running
[17:47:09][D][voice_assistant:627]: Event Type: 3
[17:47:09][D][voice_assistant:641]: STT started
[17:47:09][D][light:036]: 'Atom Echo' Setting:
[17:47:09][D][light:059]: Red: 0%, Green: 0%, Blue: 100%
[17:47:11][D][voice_assistant:627]: Event Type: 11
[17:47:11][D][voice_assistant:781]: Starting STT by VAD
[17:47:12][D][voice_assistant:627]: Event Type: 12
[17:47:12][D][voice_assistant:785]: STT by VAD end
[17:47:12][D][voice_assistant:504]: State changed from STREAMING_MICROPHONE to STOP_MICROPHONE
[17:47:12][D][voice_assistant:510]: Desired state set to AWAITING_RESPONSE
[17:47:12][D][voice_assistant:504]: State changed from STOP_MICROPHONE to STOPPING_MICROPHONE
[17:47:12][D][light:036]: 'Atom Echo' Setting:
[17:47:12][D][light:059]: Red: 0%, Green: 0%, Blue: 100%
[17:47:12][D][light:109]: Effect: 'Fast Pulse'
[17:47:12][D][esp-idf:000]: I (58467) I2S: DMA queue destroyed
[17:47:12]
[17:47:12][D][voice_assistant:504]: State changed from STOPPING_MICROPHONE to AWAITING_RESPONSE
[17:47:15][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
[17:47:15][D][esp32.preferences:114]: Saving 2 preferences to flash...
[17:47:15][D][esp32.preferences:143]: Saving 2 preferences to flash: 0 cached, 2 written, 0 failed
[17:47:16][D][voice_assistant:627]: Event Type: 4
[17:47:16][D][voice_assistant:655]: Speech recognised as: " ."
[17:47:16][D][switch:016]: 'Play Wakeword sound' Turning OFF.
[17:47:16][D][switch:055]: 'Play Wakeword sound': Sending state OFF
[17:47:16][D][voice_assistant:627]: Event Type: 5
[17:47:16][D][voice_assistant:660]: Intent started
[17:47:16][D][voice_assistant:627]: Event Type: 6
[17:47:16][D][voice_assistant:627]: Event Type: 7
[17:47:16][D][voice_assistant:683]: Response: "Sorry, I couldn't understand that"
[17:47:16][D][light:036]: 'Atom Echo' Setting:
[17:47:16][D][light:051]: Brightness: 100%
[17:47:16][D][light:059]: Red: 0%, Green: 0%, Blue: 100%
[17:47:16][D][light:109]: Effect: 'None'
[17:47:16][D][voice_assistant:627]: Event Type: 98
[17:47:16][D][voice_assistant:768]: TTS stream start
[17:47:16][D][esp-idf:000][speaker_task]: I (63323) I2S: DMA Malloc info, datalen=blocksize=512, dma_buf_count=8
[17:47:16]
[17:47:16][D][voice_assistant:504]: State changed from IDLE to START_MICROPHONE
[17:47:16][D][voice_assistant:510]: Desired state set to START_PIPELINE
[17:47:16][D][voice_assistant:221]: Starting Microphone
[17:47:16][D][voice_assistant:504]: State changed from START_MICROPHONE to STARTING_MICROPHONE
[17:47:16][D][esp-idf:000][speaker_task]: I (63430) I2S: DMA queue destroyed
[17:47:16]
[17:47:19][D][voice_assistant:627]: Event Type: 4
[17:47:19][D][voice_assistant:655]: Speech recognised as: " Turn on the battery light"
[17:47:19][D][voice_assistant:627]: Event Type: 5
[17:47:19][D][voice_assistant:660]: Intent started
[17:47:20][D][voice_assistant:627]: Event Type: 6
[17:47:20][D][voice_assistant:627]: Event Type: 7
[17:47:20][D][voice_assistant:683]: Response: "Sorry, I am not aware of any device called battery"
[17:47:20][D][light:036]: 'Atom Echo' Setting:
[17:47:20][D][light:051]: Brightness: 100%
[17:47:20][D][light:059]: Red: 0%, Green: 0%, Blue: 100%
[17:47:20][W][i2s_audio.speaker:042]: Called start while task has been already created.
[17:47:20][D][voice_assistant:627]: Event Type: 98
[17:47:20][D][voice_assistant:768]: TTS stream start
[17:47:20][D][voice_assistant:627]: Event Type: 8
[17:47:20][D][voice_assistant:703]: Response URL: "http://<IP_ADDR>:8123/api/tts_proxy/c53d8f663e718f89133e7251914040faa6866ede_en-gb_799a32846e_tts.piper.wav"
[17:47:20][D][voice_assistant:504]: State changed from STARTING_MICROPHONE to STREAMING_RESPONSE
[17:47:20][D][voice_assistant:510]: Desired state set to STREAMING_RESPONSE
[17:47:20][D][voice_assistant:627]: Event Type: 2
[17:47:20][D][voice_assistant:717]: Assist Pipeline ended
[17:47:20][D][light:036]: 'Atom Echo' Setting:
[17:47:20][D][light:051]: Brightness: 60%
[17:47:20][D][light:059]: Red: 100%, Green: 89%, Blue: 71%
[17:47:21][W][i2s_audio.speaker:042]: Called start while task has been already created.
[17:47:21][W][i2s_audio.speaker:042]: Called start while task has been already created.
[17:47:21][W][i2s_audio.speaker:042]: Called start while task has been already created.
Hi
Not sure why it won’t work for you, I suspect there are some race condition happening. I tried to simply the setup a bit and got it working by just using (not needing the on_stt_end
and play_wakeword_sound
switch)
on_wake_word_detected:
- voice_assistant.stop:
- lambda: id(va).set_use_wake_word(false);
- wait_until:
not:
- voice_assistant.is_running:
- lambda: id(echo_speaker).play(id(ok_sound), sizeof(id(ok_sound)));
- wait_until:
not:
speaker.is_playing:
- voice_assistant.start_continuous:
- delay: 10s
- lambda: id(va).set_use_wake_word(true);
You can also try even longer delays before re-enabling the wake word. This whole setup is quite hacky, it would have been nice if wakeword sound was added to voice assistant component in esphome properly.
Inspired by this comment, I was able to get it working without the stop/start of voice assistant.
on_wake_word_detected:
- microphone.stop_capture:
- wait_until:
not:
microphone.is_capturing:
- lambda: id(echo_speaker).play(id(ok_sound), sizeof(id(ok_sound)));
on_listening:
- delay: 600ms
- wait_until:
not:
speaker.is_playing:
- microphone.capture:
- light.turn_on:
id: led
blue: 100%
red: 0%
green: 0%
effect: "Slow Pulse"