From 56d0ad27f0dc67a66eb0568a78453b0e42f35b1f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 3 Apr 2024 16:53:31 -1000 Subject: [PATCH] Adjust async_load_platform comment to remove dead lock reference (#114771) * Adjust async_load_platform comment Its likely the deadlock here has been fixed for a long time, however we should still do these in a task because it has to wait for base components if they are not loaded yet. * Adjust async_load_platform comment Its likely the deadlock here has been fixed for a long time, however we should still do these in a task because it has to wait for base components if they are not loaded yet. --- homeassistant/helpers/discovery.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/discovery.py b/homeassistant/helpers/discovery.py index 4b5a0117be7..2e14759b814 100644 --- a/homeassistant/helpers/discovery.py +++ b/homeassistant/helpers/discovery.py @@ -152,8 +152,11 @@ async def async_load_platform( Use `async_listen_platform` to register a callback for these events. - Warning: Do not await this inside a setup method to avoid a dead lock. - Use `hass.async_create_task(async_load_platform(..))` instead. + Warning: This method can load a base component if its not loaded which + can take a long time since base components currently have to import + every platform integration listed under it to do config validation. + To avoid waiting for this, use + `hass.async_create_task(async_load_platform(..))` instead. """ assert hass_config is not None, "You need to pass in the real hass config"