mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-10-14 16:35:12 +02:00
The i2s_audio media_player platform was removed; rebuild the audio pipeline like mcu-echo.yaml with an i2s_audio speaker feeding a mixer, so media playback, TTS announcements, and rtttl beeps all share the one physical DAC output without conflicting. Also uses format: NONE instead of the deprecated codec_support_enabled. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
158 lines
3.3 KiB
YAML
158 lines
3.3 KiB
YAML
---
|
|
substitutions:
|
|
device: echo-1
|
|
name: Echo 1
|
|
name_short: Echo 1
|
|
area: DEV
|
|
comment: Echo
|
|
|
|
esphome:
|
|
name: mcu-${device}
|
|
friendly_name: ${name}
|
|
area: ${area}
|
|
comment: ${comment}
|
|
|
|
esp32:
|
|
variant: esp32
|
|
framework:
|
|
type: esp-idf
|
|
|
|
packages:
|
|
common: !include common/common.yaml
|
|
|
|
api:
|
|
actions:
|
|
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
|
|
- action: play_rtttl
|
|
variables:
|
|
song: string
|
|
then:
|
|
- rtttl.play:
|
|
rtttl: !lambda 'return song;'
|
|
|
|
# i2c:
|
|
# - sda: 26
|
|
# scl: 32
|
|
# scan: true #false
|
|
# frequency: 100kHz
|
|
|
|
# uart:
|
|
# id: particle_uart
|
|
# tx_pin: 21
|
|
# rx_pin: 22
|
|
# baud_rate: 9600
|
|
|
|
binary_sensor:
|
|
- platform: gpio
|
|
name: Button
|
|
pin:
|
|
number: 39
|
|
inverted: true
|
|
# on_press:
|
|
# - voice_assistant.start:
|
|
# on_release:
|
|
# - voice_assistant.stop:
|
|
on_double_click:
|
|
- logger.log: Button Pressed
|
|
- rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b"
|
|
|
|
light:
|
|
# - platform: status_led
|
|
# id: status_led_id
|
|
# output: status_led_output
|
|
- platform: esp32_rmt_led_strip
|
|
name: LED
|
|
id: neo_buildin
|
|
channel_colors: GRB
|
|
pin: 27
|
|
num_leds: 1
|
|
chipset: ws2812
|
|
|
|
# output:
|
|
# - platform: template
|
|
# id: status_led_output
|
|
# type: binary
|
|
# write_action:
|
|
# - if:
|
|
# condition:
|
|
# lambda: return state > 0;
|
|
# then:
|
|
# - light.turn_on:
|
|
# id: neo_buildin
|
|
# red: 1.0
|
|
# green: 0.0
|
|
# blue: 0.0
|
|
# brightness: 100%
|
|
# else:
|
|
# - light.turn_off:
|
|
# id: neo_buildin
|
|
# # green: 0.0
|
|
# # red: 0.0
|
|
# # blue: 0.0
|
|
# # brightness: 30%
|
|
|
|
i2s_audio:
|
|
- id: speaker_bus
|
|
i2s_lrclk_pin: 33
|
|
i2s_bclk_pin: 19
|
|
|
|
speaker:
|
|
- platform: i2s_audio
|
|
id: speaker_id
|
|
i2s_audio_id: speaker_bus
|
|
dac_type: external
|
|
i2s_dout_pin: 22
|
|
channel: mono
|
|
sample_rate: 16000
|
|
buffer_duration: 100ms
|
|
- platform: mixer
|
|
id: mixer_speaker_id
|
|
output_speaker: speaker_id
|
|
num_channels: 1
|
|
task_stack_in_psram: false
|
|
source_speakers:
|
|
- id: announcement_spk_mixer_input
|
|
- id: media_spk_mixer_input
|
|
- id: rtttl_spk_mixer_input
|
|
- platform: resampler
|
|
id: media_spk_resampling_input
|
|
output_speaker: media_spk_mixer_input
|
|
- platform: resampler
|
|
id: announcement_spk_resampling_input
|
|
output_speaker: announcement_spk_mixer_input
|
|
- platform: resampler
|
|
id: rtttl_spk_resampling_input
|
|
output_speaker: rtttl_spk_mixer_input
|
|
|
|
media_player:
|
|
- platform: speaker
|
|
id: media_out
|
|
name: ${name} Player
|
|
buffer_size: 14000
|
|
media_pipeline:
|
|
speaker: media_spk_resampling_input
|
|
format: NONE
|
|
announcement_pipeline:
|
|
speaker: announcement_spk_resampling_input
|
|
format: NONE
|
|
|
|
rtttl:
|
|
id: my_rtttl
|
|
speaker: rtttl_spk_resampling_input
|
|
|
|
microphone:
|
|
- platform: i2s_audio
|
|
id: echo_microphone
|
|
i2s_audio_id: speaker_bus
|
|
i2s_din_pin: 23
|
|
adc_type: external
|
|
pdm: true
|
|
|
|
voice_assistant:
|
|
microphone: echo_microphone
|
|
on_tts_end:
|
|
- media_player.play_media:
|
|
id: media_out
|
|
media_url: !lambda |-
|
|
return x;
|