From c9bfa66de88121ad533af4222800e383670cca93 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 6 Apr 2021 15:36:08 -1000 Subject: [PATCH 1/3] use event --- homeassistant/components/websocket_api/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/websocket_api/commands.py b/homeassistant/components/websocket_api/commands.py index f7961046043a6..33a3370366821 100644 --- a/homeassistant/components/websocket_api/commands.py +++ b/homeassistant/components/websocket_api/commands.py @@ -111,7 +111,7 @@ def handle_subscribe_bootstrap_integrations(hass, connection, msg): @callback def forward_bootstrap_integrations(message): """Forward bootstrap integrations to websocket.""" - connection.send_message(messages.result_message(msg["id"], message)) + connection.send_message(messages.event_message(msg["id"], message)) connection.subscriptions[msg["id"]] = async_dispatcher_connect( hass, SIGNAL_BOOTSTRAP_INTEGRATONS, forward_bootstrap_integrations From ebf357c438df9afc3946a305fe899d03e10b884a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 6 Apr 2021 15:58:32 -1000 Subject: [PATCH 2/3] ensure we send an empty dict at the end --- homeassistant/bootstrap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index b43e789005b5e..fc12ec065a9bd 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -440,7 +440,7 @@ async def _async_set_up_integrations( hass.data[DATA_SETUP_STARTED] = {} setup_time = hass.data[DATA_SETUP_TIME] = {} - log_task = asyncio.create_task(_async_watch_pending_setups(hass)) + watch_task = asyncio.create_task(_async_watch_pending_setups(hass)) domains_to_setup = _get_domains(hass, config) @@ -555,7 +555,9 @@ async def _async_set_up_integrations( except asyncio.TimeoutError: _LOGGER.warning("Setup timed out for stage 2 - moving forward") - log_task.cancel() + watch_task.cancel() + async_dispatcher_send(hass, SIGNAL_BOOTSTRAP_INTEGRATONS, {}) + _LOGGER.debug( "Integration setup times: %s", { From dedeb2a650fb43c9f5d880a470c6e429fb8a746b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 6 Apr 2021 16:11:53 -1000 Subject: [PATCH 3/3] Update test --- tests/components/websocket_api/test_commands.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/components/websocket_api/test_commands.py b/tests/components/websocket_api/test_commands.py index 09123db457997..3b01e6ecd8acb 100644 --- a/tests/components/websocket_api/test_commands.py +++ b/tests/components/websocket_api/test_commands.py @@ -1147,9 +1147,8 @@ async def test_subscribe_unsubscribe_bootstrap_integrations( async_dispatcher_send(hass, SIGNAL_BOOTSTRAP_INTEGRATONS, message) msg = await websocket_client.receive_json() assert msg["id"] == 7 - assert msg["success"] is True - assert msg["type"] == "result" - assert msg["result"] == message + assert msg["type"] == "event" + assert msg["event"] == message async def test_integration_setup_info(hass, websocket_client, hass_admin_user):