188 lines
3.8 KiB
YAML
188 lines
3.8 KiB
YAML
esphome:
|
|
name: voice-assistant-1
|
|
friendly_name: Voice-Assistant-1
|
|
name_add_mac_suffix: false
|
|
platformio_options:
|
|
board_build.flash_mode: dio
|
|
build_flags:
|
|
- -DCONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
|
|
- -DCONFIG_FREERTOS_HZ=1000
|
|
board_build.partitions: partitions.csv
|
|
on_boot:
|
|
priority: 600
|
|
then:
|
|
- if:
|
|
condition:
|
|
switch.is_off: mute
|
|
then:
|
|
- micro_wake_word.start:
|
|
|
|
esp32:
|
|
board: esp32-s3-devkitc-1
|
|
framework:
|
|
type: esp-idf
|
|
|
|
# Enable logging
|
|
logger:
|
|
level: WARN
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
encryption:
|
|
key: "oUOJJQHDaBvzKLAqfh3RwCEy9/KoFcj7AUgCSgTW/D8="
|
|
|
|
ota:
|
|
- platform: esphome
|
|
password: "48c1380a3d4d99d28bff36b2dc5c5e50"
|
|
|
|
wifi:
|
|
ssid: !secret wifi_iot_ssid
|
|
password: !secret wifi_password
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: "Voice-Assistant-1"
|
|
password: "pypEyxtF4xJ5"
|
|
|
|
captive_portal:
|
|
|
|
# web_server:
|
|
# port: 80
|
|
|
|
psram:
|
|
mode: octal
|
|
speed: 80MHz
|
|
|
|
light:
|
|
- platform: esp32_rmt_led_strip
|
|
id: led_ww
|
|
rgb_order: GRB
|
|
chipset: ws2812
|
|
pin: GPIO16
|
|
num_leds: 4
|
|
name: "LED bar"
|
|
effects:
|
|
- pulse:
|
|
- pulse:
|
|
name: fast pulse
|
|
transition_length: 250ms
|
|
update_interval: 250ms
|
|
- addressable_scan:
|
|
name: scan
|
|
move_interval: 100ms
|
|
scan_width: 1
|
|
|
|
switch:
|
|
- platform: template
|
|
id: mute
|
|
name: "Mute microphone"
|
|
optimistic: true
|
|
on_turn_on:
|
|
- micro_wake_word.stop:
|
|
- voice_assistant.stop:
|
|
- light.turn_on:
|
|
id: led_ww
|
|
red: 100%
|
|
green: 0%
|
|
blue: 0%
|
|
brightness: 30%
|
|
- delay: 2s
|
|
- light.turn_off:
|
|
id: led_ww
|
|
- light.turn_on:
|
|
id: led_ww
|
|
red: 100%
|
|
green: 0%
|
|
blue: 0%
|
|
brightness: 30%
|
|
on_turn_off:
|
|
- micro_wake_word.start:
|
|
- light.turn_on:
|
|
id: led_ww
|
|
red: 0%
|
|
green: 100%
|
|
blue: 0%
|
|
brightness: 60%
|
|
effect: fast pulse
|
|
- delay: 2s
|
|
- light.turn_off:
|
|
id: led_ww
|
|
|
|
i2s_audio:
|
|
- id: i2s_mic
|
|
i2s_lrclk_pin: GPIO6 # WS
|
|
i2s_bclk_pin: GPIO7 # SCK
|
|
- id: i2s_spk
|
|
i2s_lrclk_pin: GPIO45 # Use free pins on your board
|
|
i2s_bclk_pin: GPIO46 # Use free pins on your board
|
|
|
|
microphone:
|
|
- platform: i2s_audio
|
|
id: va_mic
|
|
adc_type: external
|
|
i2s_din_pin: GPIO4 # SD
|
|
channel: left
|
|
pdm: false
|
|
bits_per_sample: 32bit
|
|
i2s_audio_id: i2s_mic
|
|
|
|
output:
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO8
|
|
allow_other_uses: true
|
|
id: set_low_speaker
|
|
|
|
speaker:
|
|
- platform: i2s_audio
|
|
id: va_speaker
|
|
i2s_audio_id: i2s_spk
|
|
dac_type: external
|
|
i2s_dout_pin:
|
|
number: GPIO8 # DIN pin of the MAX98357A Audio Amplifier
|
|
allow_other_uses: true
|
|
channel: mono
|
|
bits_per_sample: 32bit
|
|
sample_rate: 16000
|
|
|
|
micro_wake_word:
|
|
models:
|
|
- model: hey_jarvis
|
|
on_wake_word_detected:
|
|
- voice_assistant.start:
|
|
- light.turn_on:
|
|
id: led_ww
|
|
red: 100%
|
|
green: 100%
|
|
blue: 100%
|
|
brightness: 30%
|
|
effect: scan
|
|
|
|
voice_assistant:
|
|
id: va
|
|
microphone: va_mic
|
|
speaker: va_speaker
|
|
noise_suppression_level: 2.0
|
|
auto_gain: 31dBFS
|
|
volume_multiplier: 4.0
|
|
on_client_connected:
|
|
- if:
|
|
condition:
|
|
switch.is_off: mute
|
|
then:
|
|
- micro_wake_word.start:
|
|
on_client_disconnected:
|
|
- micro_wake_word.stop:
|
|
- voice_assistant.stop:
|
|
on_stt_end:
|
|
then:
|
|
- light.turn_off: led_ww
|
|
on_error:
|
|
- micro_wake_word.start:
|
|
on_end:
|
|
then:
|
|
- light.turn_off: led_ww
|
|
- wait_until:
|
|
not:
|
|
voice_assistant.is_running:
|
|
- micro_wake_word.start: |