mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix smartthings doing I/O in the event loop to import platforms (#116190)
This commit is contained in:
parent
51bceb1c99
commit
8523df952e
@ -28,6 +28,7 @@ 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 homeassistant.setup import SetupPhases, async_pause_setup
|
||||
|
||||
from .config_flow import SmartThingsFlowHandler # noqa: F401
|
||||
from .const import (
|
||||
@ -170,7 +171,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
)
|
||||
|
||||
# Setup device broker
|
||||
broker = DeviceBroker(hass, entry, token, smart_app, devices, scenes)
|
||||
with async_pause_setup(hass, SetupPhases.WAIT_IMPORT_PLATFORMS):
|
||||
# DeviceBroker has a side effect of importing platform
|
||||
# modules when its created. In the future this should be
|
||||
# refactored to not do this.
|
||||
broker = await hass.async_add_import_executor_job(
|
||||
DeviceBroker, hass, entry, token, smart_app, devices, scenes
|
||||
)
|
||||
broker.connect()
|
||||
hass.data[DOMAIN][DATA_BROKERS][entry.entry_id] = broker
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user