mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 18:28:14 +02:00
Add WS command integration/wait (#142040)
* Add WS command integration/wait
* Add test
* Update homeassistant/components/websocket_api/commands.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Use helper setup.async_wait_component
* Add onboarding view
* Revert "Add onboarding view"
This reverts commit df3a1a0580
.
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
@ -59,7 +59,11 @@ from homeassistant.loader import (
|
||||
async_get_integration_descriptions,
|
||||
async_get_integrations,
|
||||
)
|
||||
from homeassistant.setup import async_get_loaded_integrations, async_get_setup_timings
|
||||
from homeassistant.setup import (
|
||||
async_get_loaded_integrations,
|
||||
async_get_setup_timings,
|
||||
async_wait_component,
|
||||
)
|
||||
from homeassistant.util.json import format_unserializable_data
|
||||
|
||||
from . import const, decorators, messages
|
||||
@ -98,6 +102,7 @@ def async_register_commands(
|
||||
async_reg(hass, handle_subscribe_entities)
|
||||
async_reg(hass, handle_supported_features)
|
||||
async_reg(hass, handle_integration_descriptions)
|
||||
async_reg(hass, handle_integration_wait)
|
||||
|
||||
|
||||
def pong_message(iden: int) -> dict[str, Any]:
|
||||
@ -923,3 +928,21 @@ async def handle_integration_descriptions(
|
||||
) -> None:
|
||||
"""Get metadata for all brands and integrations."""
|
||||
connection.send_result(msg["id"], await async_get_integration_descriptions(hass))
|
||||
|
||||
|
||||
@decorators.websocket_command(
|
||||
{
|
||||
vol.Required("type"): "integration/wait",
|
||||
vol.Required("domain"): str,
|
||||
}
|
||||
)
|
||||
@decorators.async_response
|
||||
async def handle_integration_wait(
|
||||
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
|
||||
) -> None:
|
||||
"""Handle wait for integration command."""
|
||||
|
||||
domain: str = msg["domain"]
|
||||
connection.send_result(
|
||||
msg["id"], {"integration_loaded": await async_wait_component(hass, domain)}
|
||||
)
|
||||
|
Reference in New Issue
Block a user