1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Ensure config entry platforms are excluded from reload (#42367)

This commit is contained in:
J. Nick Koston
2020-10-25 17:53:31 -05:00
committed by GitHub
parent fe62543a25
commit ce2c388c09
3 changed files with 19 additions and 5 deletions

View File

@@ -80,7 +80,9 @@ async def _resetup_platform(
# If its an entity platform, we use the entity_platform
# async_reset method
platform = async_get_platform(hass, integration_name, integration_platform)
platform = async_get_platform_without_config_entry(
hass, integration_name, integration_platform
)
if platform:
await _async_reconfig_platform(platform, root_config[integration_platform])
return
@@ -137,11 +139,13 @@ async def async_integration_yaml_config(
@callback
def async_get_platform(
def async_get_platform_without_config_entry(
hass: HomeAssistantType, integration_name: str, integration_platform_name: str
) -> Optional[EntityPlatform]:
"""Find an existing platform."""
"""Find an existing platform that is not a config entry."""
for integration_platform in async_get_platforms(hass, integration_name):
if integration_platform.config_entry is not None:
continue
if integration_platform.domain == integration_platform_name:
platform: EntityPlatform = integration_platform
return platform