) -> ConfigEntry:
"""Create sample rates config entry based on player specific helpers."""
assert CONF_ENTRY_SAMPLE_RATES.options
+ # if no supported sample rates are defined, we apply the default 44100 as only option
+ if not supported_sample_rates and max_sample_rate is None:
+ supported_sample_rates = [44100]
+ if not supported_bit_depths and max_bit_depth is None:
+ supported_bit_depths = [16]
final_supported_sample_rates = supported_sample_rates or []
final_supported_bit_depths = supported_bit_depths or []
conf_entry = ConfigEntry.from_dict(CONF_ENTRY_SAMPLE_RATES.to_dict())
options: list[ConfigValueOption] = []
default_value: list[str] = []
- if not supported_sample_rates and max_sample_rate is None:
- supported_sample_rates = [44100]
- if not supported_bit_depths and max_bit_depth is None:
- supported_bit_depths = [16]
-
for option in CONF_ENTRY_SAMPLE_RATES.options:
option_value = cast(str, option.value)
sample_rate_str, bit_depth_str = option_value.split(MULTI_VALUE_SPLITTER, 1)
bit_depth = supported_format["sample_bytes"] * 8
if bit_depth not in supported_bit_depths:
supported_bit_depths.append(bit_depth)
-
+ if not supported_sample_rates:
+ # esphome device with no media pipeline configured
+ # simply use the default config of the media pipeline
+ supported_sample_rates = [48000]
+ supported_bit_depths = [16]
return (
*base_entries,
# New ESPHome mediaplayer (used in Voice PE) uses FLAC 48khz/16 bits