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

This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-10-25 23:53:31 +01:00
1 parent fe62543a25
commit ce2c388c09
3 files changed
+19 -5

No files matched your search

+4
View File
@@ -79,6 +79,10 @@ class EntityPlatform:
self.platform_name, []
).append(self)
def __repr__(self):
"""Represent an EntityPlatform."""
return f"<EntityPlatform domain={self.domain} platform_name={self.platform_name} config_entry={self.config_entry}>"
@callback
def _get_parallel_updates_semaphore(
self, entity_has_async_update: bool
+7 -3
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