Yesterday, 04:03 PM
Hi all,
I have my working configuration here, also using media player:
May help someone, it took me 3 days to make it working
I have my working configuration here, also using media player:
Code:
esphome:
name: assistant1
friendly_name: Assistant 1
platformio_options:
board_build.flash_mode: dio
on_boot:
- light.turn_on:
id: notify_center
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"
external_components:
- source: github://pr#7672
components:
- audio
- speaker
- i2s_audio
- speaker
refresh: 0s
psram:
mode: octal # quad for N8R2 and octal for N16R8
speed: 80MHz
# Enable logging
logger:
hardware_uart: USB_SERIAL_JTAG
# Enable Home Assistant API
api:
encryption:
key: "*********************************************"
on_client_connected:
then:
- delay: 50ms
- light.turn_off: notify_center
- micro_wake_word.start:
on_client_disconnected:
then:
- voice_assistant.stop:
ota:
- platform: esphome
password: "****************************************"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: True
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Assistant1 Fallback Hotspot"
password: "********************************"
web_server:
port: 80
captive_portal:
button:
- platform: restart
name: "Restart"
- platform: template
name: "Start assist"
on_press:
then:
- voice_assistant.start
- platform: template
name: "Start continious assist"
on_press:
then:
- voice_assistant.start_continuous:
- platform: template
name: "Stop assist"
on_press:
then:
- voice_assistant.stop:
switch:
- platform: template
id: mute
name: Mute
optimistic: true
on_turn_on:
- micro_wake_word.stop:
- voice_assistant.stop:
- light.turn_on:
id: notify_center
red: 100%
green: 0%
blue: 0%
brightness: 60%
effect: fast pulse
- delay: 2s
- light.turn_off:
id: notify_center
- light.turn_on:
id: notify_center
red: 100%
green: 0%
blue: 0%
brightness: 30%
on_turn_off:
- micro_wake_word.start:
- light.turn_on:
id: notify_center
red: 0%
green: 100%
blue: 0%
brightness: 60%
effect: fast pulse
- delay: 2s
- light.turn_off:
id: notify_center
light:
- platform: esp32_rmt_led_strip
id: notify_center
rgb_order: RGB
pin: GPIO16
num_leds: 1
rmt_channel: 0
chipset: ws2812
name: "Notify light"
effects:
- pulse:
- pulse:
name: "Fast Pulse"
transition_length: 0.5s
update_interval: 0.5s
min_brightness: 0%
max_brightness: 100%
- platform: esp32_rmt_led_strip
rgb_order: GRB
pin: GPIO15
num_leds: 3
rmt_channel: 1
chipset: ws2812
name: "Lower light"
id: notify_lower
effects:
- pulse:
- pulse:
name: "Fast Pulse"
transition_length: 0.5s
update_interval: 0.5s
min_brightness: 0%
max_brightness: 100%
- addressable_color_wipe:
- addressable_scan:
name: Scan Effect
move_interval: 300ms
scan_width: 1
- addressable_scan:
name: Scan Effect 2
move_interval: 800ms
scan_width: 1
# 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
channel: left
sample_rate: 48000
media_player:
- platform: speaker
name: "Assistent media player"
id: speaker_media_player_id
speaker: va_speaker
sample_rate: 48000
on_play:
- logger.log: "Playback started!"
- light.turn_on:
id: notify_lower
red: 30%
green: 30%
blue: 0%
brightness: 100%
on_idle:
- logger.log: "Playback finished!"
- light.turn_off: notify_lower
micro_wake_word:
on_wake_word_detected:
then:
- voice_assistant.start:
wake_word: !lambda return wake_word;
models:
- model: github://esphome/micro-wake-word-models/models/v2/okay_nabu.json
voice_assistant:
id: va
microphone: va_mic
noise_suppression_level: 2.0
volume_multiplier: 4.0
media_player: speaker_media_player_id
on_start:
- light.turn_on:
id: notify_center
red: 30%
green: 30%
blue: 70%
brightness: 60%
effect: fast pulse
- media_player.volume_set: 100%
on_stt_end:
- light.turn_off: notify_center
on_error:
- micro_wake_word.start:
on_end:
- light.turn_off: notify_center
- wait_until:
not:
voice_assistant.is_running:
- micro_wake_word.start:
on_tts_start:
- light.turn_on:
id: notify_center
red: 0%
green: 30%
blue: 0%
brightness: 60%
effect: fast pulse
on_tts_end:
- delay: 2s
- light.turn_off: notify_center
May help someone, it took me 3 days to make it working