There is a default voice assistant firmware for my M5Stack atom echo that I overwrite, so that responses can come through my google home mini rather than the terrible speaker on the echo.
In short I am looking to overwrite the package on_timer_finished:
with my own
voice_assistant:
on_timer_finished:
More info
I am using this official esphome firmware package and I overwrite certain elements
For example this does a great job of disabling the speaker
speaker:
- platform: i2s_audio
id: !extend echo_speaker
i2s_dout_pin: GPIO21 # <- It is actually on 22, so this disables the speaker by overriding the package config
and this does a great job of causing the reply to replay on a seperate media_player because on_tts_end:
is not specified in the original package.
voice_assistant:
on_tts_end:
- homeassistant.service: ...
However when I add the below I find that the existing on_timer_finished:
and this one become merged into a single list which produces a terrible result
voice_assistant:
on_timer_finished:
- voice_assistant.stop:
- switch.turn_on: timer_ringing
...
And when I try the below I get an error Source for extension of ID 'va' was not found.
, I think because !extend
only works for lists and not dictionaries and voice_assistant
is a dictionary
voice_assistant:
id: !extend va
...
My full yaml
substitutions:
name: m5stack-atom-echo-b836b0
friendly_name: M5Stack Atom Echo b836b0
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: +myAPIkey=
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Until https://github.com/esphome/firmware/pull/233 is fixed/merged
update:
- platform: http_request
id: !remove update_http_request
speaker:
- platform: i2s_audio
id: !extend echo_speaker
i2s_dout_pin: GPIO21 # <- It is actually on 22, so this disables the speaker
dac_type: external
mode: mono
voice_assistant:
on_tts_end:
- homeassistant.service:
service: media_player.play_media
data:
entity_id: media_player.study_speaker # <- this is hard-coded
media_content_id: !lambda 'return x;'
media_content_type: music
announce: "true"
on_timer_finished:
- voice_assistant.stop:
- switch.turn_on: timer_ringing
- wait_until:
not:
microphone.is_capturing:
- light.turn_on:
id: led
red: 0%
green: 100%
blue: 0%
brightness: 100%
effect: "Fast Pulse"
- while:
condition:
switch.is_on: timer_ringing
then:
- homeassistant.service:
service: media_player.play_media
data:
entity_id: media_player.study_speaker # <- this is hard-coded
media_content_id: id(timer_finished_wave_file)
media_content_type: music
announce: "true"
- delay: 1s
- wait_until:
not:
speaker.is_playing:
- light.turn_off: led
- switch.turn_off: timer_ringing
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
- script.execute: reset_led
So how to a override/overwrite on_timer_finished:
rather than just appending it?