Small speed up to adding entities (#48353)

pull/48362/head
J. Nick Koston 2021-03-26 01:05:19 -10:00 committed by GitHub
parent 8f40c87069
commit c4f98a3084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -18,7 +18,12 @@ from homeassistant.core import (
valid_entity_id,
)
from homeassistant.exceptions import HomeAssistantError, PlatformNotReady
from homeassistant.helpers import config_validation as cv, service
from homeassistant.helpers import (
config_validation as cv,
device_registry as dev_reg,
entity_registry as ent_reg,
service,
)
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.util.async_ import run_callback_threadsafe
@ -298,8 +303,8 @@ class EntityPlatform:
hass = self.hass
device_registry = await hass.helpers.device_registry.async_get_registry()
entity_registry = await hass.helpers.entity_registry.async_get_registry()
device_registry = dev_reg.async_get(hass)
entity_registry = ent_reg.async_get(hass)
tasks = [
self._async_add_entity( # type: ignore
entity, update_before_add, entity_registry, device_registry