Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to use AS ESP32-S3 voice assistant in home assistant
#18
(11-03-2025, 07:08 PM)kirkond Wrote:
(12-10-2024, 04:19 PM)biofects Wrote:
(12-08-2024, 11:33 AM)eyevisions Wrote: Also just beginning with ESP and find it hard to follow. So keep on reading Big Grin like the idea for volume control. Is there also a way to use the speaker to play media to it? I like to use bought leds so i flash it a second time and change gpio en leaf the RGB. There must be a beter way

I will be adding that to yaml, once i get the volume working properly its close but something is still off

esphome:
  name: as
  friendly_name: AS
  platformio_options:
    board_build.flash_mode: dio
  on_boot:
    - light.turn_on:
        id: led_ww
        brightness: 60%

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 для N8R2 и octal для N16R8
  speed: 80MHz

# Логирование
logger:
  hardware_uart: USB_SERIAL_JTAG

# Home Assistant API
api:
  encryption:
    key: "TFpb+pBAvQIS1MVwaA7EoJ2DkpWE+79UvVro7yMyGdU="
  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
    password: "1245211a05eef56614a2ef5a3f3e971c"

wifi:
  ssid: "KinCony"
  password: "a12345678"
  # Резервная точка доступа
  ap:
    ssid: "Esp32-S3-Wake-Word"
    password: "LJfUrdJk3svP"

captive_portal:

# Кнопка перезагрузки
button:
  - platform: restart
    name: "Перезагрузка"
    id: but_rest

# Светодиодная лампа - ИСПРАВЛЕННАЯ КОНФИГУРАЦИЯ
output:
  - platform: ledc
    id: led_output
    pin: GPIO16

light:
  - platform: monochromatic
    id: led_ww
    name: "Светодиод на плате"
    output: led_output

# Переключатель микрофона
switch:
  - platform: template
    id: mute
    name: "Отключить микрофон"
    optimistic: true
    on_turn_on:
      - micro_wake_word.stop:
      - voice_assistant.stop:
      - light.turn_on:
          id: led_ww
          brightness: 60%
      - delay: 2s
      - light.turn_off:
          id: led_ww
      - light.turn_on:
          id: led_ww
          brightness: 30%
    on_turn_off:
      - micro_wake_word.start:
      - light.turn_on:
          id: led_ww
          brightness: 60%
      - delay: 2s
      - light.turn_off:
          id: led_ww

# Аудио конфигурация
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 пин на INMP441
    channel: left
    pdm: false
    i2s_audio_id: i2s_in
    bits_per_sample: 32bit

# Динамик
speaker:
  platform: i2s_audio
  id: va_speaker
  i2s_audio_id: i2s_speaker
  dac_type: external
  i2s_dout_pin: GPIO8    # DIN пин усилителя MAX98357A
  channel: mono

# Распознавание ключевого слова
micro_wake_word:
  on_wake_word_detected:
    - voice_assistant.start:
    - light.turn_on:
        id: led_ww
        brightness: 60%
  models:
    - model: hey_jarvis

# Голосовой помощник
voice_assistant:
  id: va
  microphone: va_mic
  noise_suppression_level: 2.0
  volume_multiplier: 4.0
  speaker: va_speaker
  on_listening:
    then:
      - light.turn_on:
          id: led_ww
          brightness: 80%
  on_stt_end:
    then:
      - light.turn_off: led_ww
  on_tts_start:
    then:
      - light.turn_on:
          id: led_ww
          brightness: 40%
  on_error:
    then:
      - light.turn_on:
          id: led_ww
          brightness: 100%
      - delay: 1s
      - light.turn_off: led_ww
      - micro_wake_word.start:
  on_end:
    then:
      - light.turn_off: led_ww
      - wait_until:
          condition:
            not:
              voice_assistant.is_running:
      - micro_wake_word.start:
он разве работает?
Reply


Messages In This Thread
RE: how to use AS ESP32-S3 voice assistant in home assistant - by kirkond - 11-07-2025, 05:23 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)