Fix subscribe_bootstrap_integrations to send events (#48754)

This commit is contained in:
J. Nick Koston 2021-04-08 07:30:33 -10:00 committed by GitHub
parent c7e4857d2c
commit 1f80c756ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -440,7 +440,7 @@ async def _async_set_up_integrations(
hass.data[DATA_SETUP_STARTED] = {} hass.data[DATA_SETUP_STARTED] = {}
setup_time = hass.data[DATA_SETUP_TIME] = {} 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) domains_to_setup = _get_domains(hass, config)
@ -555,7 +555,9 @@ async def _async_set_up_integrations(
except asyncio.TimeoutError: except asyncio.TimeoutError:
_LOGGER.warning("Setup timed out for stage 2 - moving forward") _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( _LOGGER.debug(
"Integration setup times: %s", "Integration setup times: %s",
{ {

View File

@ -111,7 +111,7 @@ def handle_subscribe_bootstrap_integrations(hass, connection, msg):
@callback @callback
def forward_bootstrap_integrations(message): def forward_bootstrap_integrations(message):
"""Forward bootstrap integrations to websocket.""" """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( connection.subscriptions[msg["id"]] = async_dispatcher_connect(
hass, SIGNAL_BOOTSTRAP_INTEGRATONS, forward_bootstrap_integrations hass, SIGNAL_BOOTSTRAP_INTEGRATONS, forward_bootstrap_integrations

View File

@ -1147,9 +1147,8 @@ async def test_subscribe_unsubscribe_bootstrap_integrations(
async_dispatcher_send(hass, SIGNAL_BOOTSTRAP_INTEGRATONS, message) async_dispatcher_send(hass, SIGNAL_BOOTSTRAP_INTEGRATONS, message)
msg = await websocket_client.receive_json() msg = await websocket_client.receive_json()
assert msg["id"] == 7 assert msg["id"] == 7
assert msg["success"] is True assert msg["type"] == "event"
assert msg["type"] == "result" assert msg["event"] == message
assert msg["result"] == message
async def test_integration_setup_info(hass, websocket_client, hass_admin_user): async def test_integration_setup_info(hass, websocket_client, hass_admin_user):