diff --git a/homeassistant/components/esphome/select.py b/homeassistant/components/esphome/select.py index d7cecf07d9e..1323c9f5666 100644 --- a/homeassistant/components/esphome/select.py +++ b/homeassistant/components/esphome/select.py @@ -1,12 +1,12 @@ """Support for esphome selects.""" from __future__ import annotations -from aioesphomeapi import SelectInfo, SelectState +from aioesphomeapi import EntityInfo, SelectInfo, SelectState from homeassistant.components.assist_pipeline.select import AssistPipelineSelect from homeassistant.components.select import SelectEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.core import HomeAssistant +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import ( @@ -44,10 +44,11 @@ async def async_setup_entry( class EsphomeSelect(EsphomeEntity[SelectInfo, SelectState], SelectEntity): """A select implementation for esphome.""" - @property - def options(self) -> list[str]: - """Return a set of selectable options.""" - return self._static_info.options + @callback + def _on_static_info_update(self, static_info: EntityInfo) -> None: + """Set attrs from static info.""" + super()._on_static_info_update(static_info) + self._attr_options = self._static_info.options @property @esphome_state_property @@ -58,7 +59,7 @@ class EsphomeSelect(EsphomeEntity[SelectInfo, SelectState], SelectEntity): async def async_select_option(self, option: str) -> None: """Change the selected option.""" - await self._client.select_command(self._static_info.key, option) + await self._client.select_command(self._key, option) class EsphomeAssistPipelineSelect(EsphomeAssistEntity, AssistPipelineSelect):