Add sendspin functionality for Sonocottas ESP32 hifi
This commit is contained in:
committed by
Fritiof Hedman
parent
2e17dadd27
commit
bb15cbe280
174
esphome/sonocotta/esp32-hifi/esp32-sendspin-beta.yaml
Normal file
174
esphome/sonocotta/esp32-hifi/esp32-sendspin-beta.yaml
Normal file
@@ -0,0 +1,174 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This file incorporates and is derived from material originally licensed under:
|
||||
# - Apache License, Version 2.0
|
||||
# - MIT License
|
||||
#
|
||||
# The combined and modified work is licensed under the Apache License, Version 2.0.
|
||||
# See the LICENSE file in the repository root for full license text.
|
||||
|
||||
# This is based on a mix of
|
||||
# - https://github.com/esphome/home-assistant-voice-pe/blob/b2cf3e52a9fd3a701d2ff917c296e8ef9032d14e/home-assistant-voice.yaml (MIT license)
|
||||
# - https://github.com/sonocotta/esp32-audio-dock/blob/8f39d54b785ee3403ddc8afa4e12c99eb69c9e6a/firmware/esphome/hifi-esp32-idf.yaml (Apache 2.0 License)
|
||||
|
||||
|
||||
external_components:
|
||||
- source:
|
||||
# https://github.com/esphome/esphome/pull/12253
|
||||
type: git
|
||||
url: https://github.com/esphome/esphome
|
||||
ref: 0fe230114c80b6d3378f04c777baadee178e40ad
|
||||
components: [mixer]
|
||||
- source:
|
||||
# https://github.com/esphome/esphome/pull/12254
|
||||
type: git
|
||||
url: https://github.com/esphome/esphome
|
||||
ref: 1ab4b990092ae063a16cb1511a188c536fdb336e
|
||||
components: [resampler]
|
||||
- source:
|
||||
# https://github.com/esphome/esphome/pull/12256
|
||||
type: git
|
||||
url: https://github.com/esphome/esphome
|
||||
ref: 047ba60f01af84513f8d5aabaa2a53074facee8f
|
||||
components: [audio]
|
||||
- source:
|
||||
# https://github.com/esphome/esphome/pull/12258
|
||||
type: git
|
||||
url: https://github.com/esphome/esphome
|
||||
ref: bff22983a390352360796f8e1363127e0cd1f898
|
||||
components: [media_player]
|
||||
- source:
|
||||
# https://github.com/esphome/esphome/pull/12284
|
||||
type: git
|
||||
url: https://github.com/esphome/esphome
|
||||
ref: 9d2d2f6287a72af6397dfd93ee56fbab25c1d32f
|
||||
components: [mdns, sendspin]
|
||||
- source:
|
||||
# https://github.com/esphome/esphome/pull/12429
|
||||
type: git
|
||||
url: https://github.com/esphome/esphome
|
||||
ref: 72499eaed2ed54316aca90d368053aa2e1a54f5f
|
||||
refresh: 0s
|
||||
components: [file, http_request, media_source, speaker_source]
|
||||
|
||||
esphome:
|
||||
name: test-player
|
||||
friendly_name: test-player
|
||||
min_version: 2025.12.0
|
||||
|
||||
esp32:
|
||||
board: mhetesp32minikit
|
||||
flash_size: 8MB
|
||||
framework:
|
||||
type: esp-idf
|
||||
version: recommended
|
||||
sdkconfig_options:
|
||||
CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST: "y"
|
||||
CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY: "y"
|
||||
|
||||
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC: "y"
|
||||
CONFIG_MBEDTLS_SSL_PROTO_TLS1_3: "y" # TLS1.3 support isn't enabled by default in IDF 5.1.5
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
encryption:
|
||||
key: "keykeykey"
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
password: "keykeykey"
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "Test-Player Fallback Hotspot"
|
||||
password: !secret ap_fallback
|
||||
|
||||
captive_portal:
|
||||
|
||||
psram:
|
||||
speed: 80MHz
|
||||
|
||||
i2s_audio:
|
||||
i2s_lrclk_pin: GPIO25
|
||||
i2s_bclk_pin: GPIO26
|
||||
|
||||
speaker:
|
||||
- platform: i2s_audio
|
||||
id: speaker_id
|
||||
dac_type: external
|
||||
i2s_dout_pin: GPIO22
|
||||
channel: stereo
|
||||
sample_rate: 48000
|
||||
timeout: never
|
||||
# Virtual speakers to combine the announcement and media streams together into one output
|
||||
- platform: mixer
|
||||
id: mixing_speaker
|
||||
output_speaker: speaker_id
|
||||
num_channels: 2
|
||||
task_stack_in_psram: False
|
||||
source_speakers:
|
||||
- id: announcement_mixing_input
|
||||
timeout: never
|
||||
- id: media_mixing_input
|
||||
timeout: never
|
||||
|
||||
# Virtual speakers to resample each pipelines' audio, if necessary, as the mixer speaker requires the same sample rate
|
||||
- platform: resampler
|
||||
id: announcement_resampling_speaker
|
||||
output_speaker: announcement_mixing_input
|
||||
sample_rate: 48000
|
||||
bits_per_sample: 16
|
||||
- platform: resampler
|
||||
id: media_resampling_speaker
|
||||
output_speaker: media_mixing_input
|
||||
sample_rate: 48000
|
||||
bits_per_sample: 16
|
||||
|
||||
|
||||
sendspin:
|
||||
id: sendspin_hub
|
||||
task_stack_in_psram: false
|
||||
kalman_process_error: 0.01
|
||||
|
||||
media_source:
|
||||
- platform: sendspin
|
||||
id: sendspin_source
|
||||
# - platform: http_request
|
||||
# id: http_source
|
||||
# buffer_size: 500000
|
||||
|
||||
media_player:
|
||||
- platform: sendspin
|
||||
id: sendspin_group_media_player
|
||||
- platform: speaker_source
|
||||
id: external_media_player
|
||||
name: Media Player
|
||||
announcement_speaker: announcement_resampling_speaker
|
||||
media_speaker: media_resampling_speaker
|
||||
announcement_pipeline:
|
||||
format: FLAC # FLAC is the least processor intensive codec
|
||||
num_channels: 1 # Stereo audio is unnecessary for announcements
|
||||
sample_rate: 48000
|
||||
media_pipeline:
|
||||
format: FLAC # FLAC is the least processor intensive codec
|
||||
num_channels: 2
|
||||
sample_rate: 48000
|
||||
volume_increment: 0.05
|
||||
volume_min: 0.4
|
||||
volume_max: 0.85
|
||||
sources:
|
||||
# - http_source
|
||||
- sendspin_source
|
||||
on_announcement:
|
||||
- mixer_speaker.apply_ducking:
|
||||
id: media_mixing_input
|
||||
decibel_reduction: 20
|
||||
duration: 0.0s
|
||||
|
||||
Reference in New Issue
Block a user