Fix smartthings doing blocking I/O in the event loop to import platforms (#113382)
parent
972efada75
commit
6832611550
|
@ -27,6 +27,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.loader import async_get_loaded_integration
|
||||
|
||||
from .config_flow import SmartThingsFlowHandler # noqa: F401
|
||||
from .const import (
|
||||
|
@ -104,6 +105,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
|
||||
api = SmartThings(async_get_clientsession(hass), entry.data[CONF_ACCESS_TOKEN])
|
||||
|
||||
# Ensure platform modules are loaded since the DeviceBroker will
|
||||
# import them below and we want them to be cached ahead of time
|
||||
# so the integration does not do blocking I/O in the event loop
|
||||
# to import the modules.
|
||||
await async_get_loaded_integration(hass, DOMAIN).async_get_platforms(PLATFORMS)
|
||||
|
||||
remove_entry = False
|
||||
try:
|
||||
# See if the app is already setup. This occurs when there are
|
||||
|
|
Loading…
Reference in New Issue