Hallo,
ich habe mir einen ESP32-S3 als Voice Assistant gebaut. Als Anleitung habe ich dieses video
[https://youtu.be/R2SJLdFL0T4?si=frzI7MNYgKX3B8T5](https://AI Sprachassistent DIY) und diese Anleitung [How To Setup On-Device Wake Word Detection For Voice Assistant using Micro Wake Word | Smart Home Circle](https://Smarthomecircle ESP32-S3) genommen . Allerdings benutzen die mww also microwakeword und es werden keine media player als Lautsprecher eingebunden. Und genau das benötige ich. Ich möchte eigene Wakewords nutzen, das geht halt mit mww noch nicht. Und ich möchte die Sprachausgabe auf meinem homepod wiedergeben.
Ich habe jetzt folgendes Script aufgespielt:
substitutions:
device_name: "esp32-s3-54412c"
friendly_name: "ESP32-S3 54412c"
device_description: "XIAO ESP32 S3"
# Phases of the Voice Assistant
# IDLE: The voice assistant is ready to be triggered by a wake-word
voice_assist_idle_phase_id: '1'
# LISTENING: The voice assistant is ready to listen to a voice command (after being triggered by the wake word)
voice_assist_listening_phase_id: '2'
# THINKING: The voice assistant is currently processing the command
voice_assist_thinking_phase_id: '3'
# REPLYING: The voice assistant is replying to the command
voice_assist_replying_phase_id: '4'
# NOT_READY: The voice assistant is not ready
voice_assist_not_ready_phase_id: '10'
# ERROR: The voice assistant encountered an error
voice_assist_error_phase_id: '11'
# MUTED: The voice assistant is muted and will not reply to a wake-word
voice_assist_muted_phase_id: '12'
external_components:
- source:
type: git
url: https://github.com/gnumpi/esphome_audio
ref: main
#type: local
#path: /Users/siekmann/Privat/Projects/espHome/esphome_audio/esphome/components
components: [ adf_pipeline, i2s_audio ]
esphome:
name: esp32-s3-54412c
friendly_name: ESP32-S3 54412c
platformio_options:
board_build.flash_mode: dio
on_boot:
- light.turn_on:
id: led_ww
blue: 100%
brightness: 60%
effect: fast pulse
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
CONFIG_AUDIO_BOARD_CUSTOM: "y"
psram:
mode: octal # quad for N8R2 and octal for N16R8
speed: 80MHz
# Enable logging
logger:
hardware_uart: UART0
# Enable Home Assistant API
api:
encryption:
key: "ANY API KEY"
on_client_connected:
then:
- delay: 50ms
- light.turn_off: led_ww
# - micro_wake_word.start:
on_client_disconnected:
then:
- voice_assistant.stop:
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
#ap:
# ssid: "Esp32-S3-Wake-Word"
# password: "LJfUrdJk3svP"
captive_portal:
button:
- platform: restart
name: "Restart"
id: but_rest
switch:
- platform: template
id: use_wake_word
name: Use wake word
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
entity_category: config
on_turn_on:
- lambda: id(assist).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(assist).set_use_wake_word(false);
light:
- platform: esp32_rmt_led_strip
id: led_ww
rgb_order: GRB
pin: GPIO48
num_leds: 1
rmt_channel: 0
chipset: ws2812
name: "on board light"
effects:
- pulse:
- pulse:
name: "Fast Pulse"
transition_length: 0.5s
update_interval: 0.5s
min_brightness: 0%
max_brightness: 100%
# Audio and Voice Assistant Config
i2s_audio:
- id: i2s_in
i2s_lrclk_pin: GPIO3 #WS
i2s_bclk_pin: GPIO2 #SCK
- id: i2s_speaker
i2s_lrclk_pin: GPIO6 #LRC
i2s_bclk_pin: GPIO7 #BLCK
microphone:
- platform: i2s_audio
id: va_mic
adc_type: external
i2s_din_pin: GPIO4 #SD pin on the INMP441
channel: left
pdm: false
i2s_audio_id: i2s_in
bits_per_sample: 32 bit
speaker:
platform: i2s_audio
id: va_speaker
i2s_audio_id: i2s_speaker
dac_type: external
i2s_dout_pin: GPIO8 # DIN Pin of the MAX98357A Audio Amplifier
mode: mono
#micro_wake_word:
# on_wake_word_detected:
# # then:
# - voice_assistant.start:
# wake_word: !lambda return wake_word;
# - light.turn_on:
# id: led_ww
# red: 30%
# green: 30%
# blue: 70%
# brightness: 60%
# effect: fast pulse
# model: hey_jarvis
voice_assistant:
id: assist
microphone: va_mic
noise_suppression_level: 1
auto_gain: 31dBFS
volume_multiplier: 15.0
speaker: va_speaker
use_wake_word: true
on_client_connected:
- lambda: id(assist).set_use_wake_word(true);
- voice_assistant.start_continuous:
on_tts_end:
- homeassistant.service:
service: media_player.play_media
data:
entity_id: media_player.homepod_schlafzimmer
media_content_id: !lambda 'return x;'
media_content_type: music
announce: "true"
Das funktoniert auch soweit, dass die Sprachbefehle ausgeführt werden, die Reaktion ist auch besser und zuverlässiger als beim M5ATOM. Ich bekomme aber weder über den verdrahteten Lautsprecher noch über den Media Player eine Ausgabe. Kann mir da jemand helfen was ich ändern muss?
Gruß
Elmar