Start homekit bridges with asyncio.gather (#42498)

pull/42501/head
J. Nick Koston 2020-10-27 19:58:07 -05:00 committed by GitHub
parent 3c8c5a814b
commit 2858a90d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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