Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AS ESPHome yaml for home assistant
#21
Here is mine yaml file now trying to make the speaker a media_player. with the file of filip mine assistant cannot make long answers.

script:
esphome:
name: as
friendly_name: AS
platformio_options:
board_build.flash_mode: dio
on_boot:
- light.turn_on:
id: led_ww
red: 100%
green: 9%
blue: 86%
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: USB_SERIAL_JTAG

# Enable Home Assistant API
api:
encryption:
key: "yourkey"
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: "yourpassword"

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
reboot_timeout: 10min
power_save_mode: none
ap:
ssid: "Esp32-S3-Wake-Word"
password: "hiplahopla"

captive_portal:

button:
- platform: restart
name: "Restart"
id: but_rest

switch:
- platform: template
id: mute
name: mute
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: 100%
effect: Scan Effect 2
- delay: 8s
- light.turn_off:
id: led_ww
- light.turn_on:
id: led_ww
red: 100%
green: 0%
blue: 0%
brightness: 60%
- light.turn_on:
id: led_ww2
red: 100%
green: 0%
blue: 0%
brightness: 60%
on_turn_off:
- micro_wake_word.start:
- light.turn_on:
id: led_ww
red: 0%
green: 100%
blue: 0%
brightness: 100%
effect: Scan Effect
- delay: 8s
- light.turn_off:
id: led_ww
- light.turn_on:
id: led_ww
red: 100%
green: 9%
blue: 86%
brightness: 60%
- light.turn_on:
id: led_ww2
red: 0%
green: 0%
blue: 100%
brightness: 60%


light:
- platform: esp32_rmt_led_strip
id: led_ww
rgb_order: GRB
pin: GPIO15
num_leds: 3
rmt_channel: 0
chipset: ws2812
name: "On Board Light 1"
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" # Aanhalingstekens voor consistentie
move_interval: 300ms
scan_width: 1
- addressable_scan:
name: "Scan Effect 2" # Aanhalingstekens voor consistentie
move_interval: 600ms
scan_width: 1

- platform: esp32_rmt_led_strip
id: led_ww2
rgb_order: RGB
pin: GPIO16
num_leds: 1
rmt_channel: 1
chipset: ws2812
name: "On Board Light 2"
effects:
- pulse:
- pulse:
name: "Fast Pulse"
transition_length: 0.5s
update_interval: 0.5s
min_brightness: 0%
max_brightness: 100%

number:
- platform: template
name: "Speaker Volume"
id: speaker_volume
optimistic: true
min_value: 0.0
max_value: 1.0
step: 0.01
initial_value: 0.6
restore_value: true # Nu correct!
unit_of_measurement: "Volume (%)"
set_action:
- lambda: |-
id(va_speaker).set_volume(x);

# Audio and Voice Assistant Config
i2s_audio:
- id: i2s_in
i2s_lrclk_pin: GPIO3
i2s_bclk_pin: GPIO2
- id: i2s_speaker
i2s_lrclk_pin: GPIO6
i2s_bclk_pin: GPIO7

microphone:
- platform: i2s_audio
id: va_mic
adc_type: external
i2s_din_pin: GPIO4
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
channel: mono

micro_wake_word:
on_wake_word_detected:
- voice_assistant.start:
wake_word: !lambda return wake_word;
- light.turn_on:
id: led_ww2
red: 0%
green: 100%
blue: 0%
brightness: 100%
effect: fast pulse
models:
- model: alexa

voice_assistant:
id: va
microphone: va_mic
noise_suppression_level: 2.0
volume_multiplier: 6.0
speaker: va_speaker
on_stt_end:
then:
- light.turn_on:
id: led_ww2
red: 0%
green: 0%
blue: 100%
brightness: 100%
on_error:
- light.turn_on:
id: led_ww
red: 100%
green: 0%
blue: 0%
brightness: 60%
- delay: 2s
- micro_wake_word.start:
on_end:
then:
- light.turn_off: led_ww2
- delay: 2s
- light.turn_on: led_ww2
- wait_until:
not:
voice_assistant.is_running:
- micro_wake_word.start:
Reply


Messages In This Thread
AS ESPHome yaml for home assistant - by admin - 10-19-2024, 12:09 PM
RE: AS ESPHome yaml for home assistant - by admin - 11-09-2024, 12:00 PM
RE: AS ESPHome yaml for home assistant - by admin - 11-09-2024, 12:29 PM
RE: AS ESPHome yaml for home assistant - by admin - 11-12-2024, 10:17 PM
RE: AS ESPHome yaml for home assistant - by admin - 11-22-2024, 10:36 PM
RE: AS ESPHome yaml for home assistant - by admin - 11-28-2024, 11:00 PM
RE: AS ESPHome yaml for home assistant - by admin - 12-02-2024, 10:59 PM
RE: AS ESPHome yaml for home assistant - by admin - 12-05-2024, 11:21 PM
RE: AS ESPHome yaml for home assistant - by admin - 12-20-2024, 11:29 PM
RE: AS ESPHome yaml for home assistant - by admin - 12-28-2024, 01:23 AM
RE: AS ESPHome yaml for home assistant - by eyevisions - 12-28-2024, 12:48 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)