Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions homeassistant/components/websocket_api/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,17 @@ def handle_get_config(
connection.send_result(msg["id"], hass.config.as_dict())


@decorators.websocket_command({vol.Required("type"): "manifest/list"})
@decorators.websocket_command(
{vol.Required("type"): "manifest/list", vol.Optional("integrations"): [str]}
)
@decorators.async_response
async def handle_manifest_list(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle integrations command."""
loaded_integrations = async_get_loaded_integrations(hass)
wanted_integrations = msg.get("integrations", async_get_loaded_integrations(hass))
Comment thread
bdraco marked this conversation as resolved.
Outdated
integrations = await asyncio.gather(
*(async_get_integration(hass, domain) for domain in loaded_integrations)
*(async_get_integration(hass, domain) for domain in wanted_integrations)
)
connection.send_result(
msg["id"], [integration.manifest for integration in integrations]
Expand Down
19 changes: 19 additions & 0 deletions tests/components/websocket_api/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,25 @@ async def test_manifest_list(hass, websocket_client):
]


async def test_manifest_list_specific_integrations(hass, websocket_client):
"""Test loading manifests for specific integrations."""
websocket_api = await async_get_integration(hass, "websocket_api")

await websocket_client.send_json(
{"id": 5, "type": "manifest/list", "integrations": ["hue", "websocket_api"]}
)
hue = await async_get_integration(hass, "hue")

msg = await websocket_client.receive_json()
assert msg["id"] == 5
assert msg["type"] == const.TYPE_RESULT
assert msg["success"]
assert sorted(msg["result"], key=lambda manifest: manifest["domain"]) == [
hue.manifest,
websocket_api.manifest,
]


async def test_manifest_get(hass, websocket_client):
"""Test getting a manifest."""
hue = await async_get_integration(hass, "hue")
Expand Down