From 7425b8d3b18974675590e0b6c835c0faae321f06 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Oct 2026 10:51:36 -1000 Subject: [PATCH] [es8388] Use Apply entities for the line selects --- esphome/components/es8388/select/__init__.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/esphome/components/es8388/select/__init__.py b/esphome/components/es8388/select/__init__.py index f0e3f5b7c89..a0d49fbcad5 100644 --- a/esphome/components/es8388/select/__init__.py +++ b/esphome/components/es8388/select/__init__.py @@ -28,14 +28,12 @@ ADC_INPUT_MIC_OPTIONS = { } ADC_INPUT_MIC_OPTION_NAMES = list(ADC_INPUT_MIC_OPTIONS) -DacOutputSelect = es8388_ns.class_("DacOutputSelect", select.Select) -ADCInputMicSelect = es8388_ns.class_("ADCInputMicSelect", select.Select) CONFIG_SCHEMA = cv.All( { cv.GenerateID(CONF_ES8388_ID): cv.use_id(ES8388), cv.Optional(CONF_DAC_OUTPUT): select.select_schema( - DacOutputSelect, + select.ApplySelect, entity_category=ENTITY_CATEGORY_CONFIG, icon=ICON_CHIP, ).extend( @@ -46,7 +44,7 @@ CONFIG_SCHEMA = cv.All( } ), cv.Optional(CONF_ADC_INPUT_MIC): select.select_schema( - ADCInputMicSelect, + select.ApplySelect, entity_category=ENTITY_CATEGORY_CONFIG, icon=ICON_CHIP, ).extend( @@ -65,12 +63,18 @@ async def to_code(config: ConfigType) -> None: hub = await cg.get_variable(config[CONF_ES8388_ID]) selects = select.sub_selects(config, parent=hub) await selects( - CONF_DAC_OUTPUT, hub.set_dac_output_select, options=DAC_OUTPUT_OPTION_NAMES + CONF_DAC_OUTPUT, + hub.set_dac_output_select, + options=DAC_OUTPUT_OPTION_NAMES, + apply="set_dac_output(static_cast(index))", + publish="before", ) await selects( CONF_ADC_INPUT_MIC, hub.set_adc_input_mic_select, options=ADC_INPUT_MIC_OPTION_NAMES, + apply="set_adc_input_mic(static_cast(index))", + publish="before", ) if ( initial := config.get(CONF_DAC_OUTPUT, {}).get(CONF_INITIAL_OPTION)