mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Avoid creating inner function in EntityComponent setup (#114050)
This commit is contained in:
parent
4e03d9cd47
commit
1c1d8d0317
@ -156,16 +156,16 @@ class EntityComponent(Generic[_EntityT]):
|
||||
|
||||
# Generic discovery listener for loading platform dynamically
|
||||
# Refer to: homeassistant.helpers.discovery.async_load_platform()
|
||||
async def component_platform_discovered(
|
||||
platform: str, info: dict[str, Any] | None
|
||||
) -> None:
|
||||
"""Handle the loading of a platform."""
|
||||
await self.async_setup_platform(platform, {}, info)
|
||||
|
||||
discovery.async_listen_platform(
|
||||
self.hass, self.domain, component_platform_discovered
|
||||
self.hass, self.domain, self._async_component_platform_discovered
|
||||
)
|
||||
|
||||
async def _async_component_platform_discovered(
|
||||
self, platform: str, info: dict[str, Any] | None
|
||||
) -> None:
|
||||
"""Handle the loading of a platform."""
|
||||
await self.async_setup_platform(platform, {}, info)
|
||||
|
||||
async def async_setup_entry(self, config_entry: ConfigEntry) -> bool:
|
||||
"""Set up a config entry."""
|
||||
platform_type = config_entry.domain
|
||||
|
Loading…
x
Reference in New Issue
Block a user