From 2858a90d5cf42ff17829b270498c5c127b688ce2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 27 Oct 2020 19:58:07 -0500 Subject: [PATCH] Start homekit bridges with asyncio.gather (#42498) --- homeassistant/components/homekit/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index 742e41213a7..e43847da56c 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -355,6 +355,7 @@ def _async_register_events_and_services(hass: HomeAssistant): async def async_handle_homekit_service_start(service): """Handle start HomeKit service call.""" + tasks = [] for entry_id in hass.data[DOMAIN]: if HOMEKIT not in hass.data[DOMAIN][entry_id]: continue @@ -368,7 +369,8 @@ def _async_register_events_and_services(hass: HomeAssistant): "been stopped" ) continue - await homekit.async_start() + tasks.append(homekit.async_start()) + await asyncio.gather(*tasks) hass.services.async_register( DOMAIN, SERVICE_HOMEKIT_START, async_handle_homekit_service_start