Integrations v2.1: Virtual integrations (#80613)

This commit is contained in:
Franck Nijhof 2022-10-21 05:09:06 +02:00 committed by GitHub
parent 6c23de94e1
commit bb287dd0ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 2968 additions and 2720 deletions

View file

@ -21,7 +21,6 @@ from homeassistant.exceptions import (
TemplateError,
Unauthorized,
)
from homeassistant.generated import supported_brands
from homeassistant.helpers import config_validation as cv, entity, template
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.event import (
@ -74,7 +73,6 @@ def async_register_commands(
async_reg(hass, handle_unsubscribe_events)
async_reg(hass, handle_validate_config)
async_reg(hass, handle_subscribe_entities)
async_reg(hass, handle_supported_brands)
async_reg(hass, handle_supported_features)
async_reg(hass, handle_integration_descriptions)
@ -705,31 +703,6 @@ async def handle_validate_config(
connection.send_result(msg["id"], result)
@decorators.websocket_command(
{
vol.Required("type"): "supported_brands",
}
)
@decorators.async_response
async def handle_supported_brands(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle supported brands command."""
data = {}
ints_or_excs = await async_get_integrations(
hass, supported_brands.HAS_SUPPORTED_BRANDS
)
for int_or_exc in ints_or_excs.values():
if isinstance(int_or_exc, Exception):
raise int_or_exc
# Happens if a custom component without supported brands overrides a built-in one with supported brands
if "supported_brands" not in int_or_exc.manifest:
continue
data[int_or_exc.domain] = int_or_exc.manifest["supported_brands"]
connection.send_result(msg["id"], data)
@callback
@decorators.websocket_command(
{