Fix custom components not working with integration descriptions (#80686)

This commit is contained in:
Paulus Schoutsen 2022-10-20 13:25:24 -04:00 committed by GitHub
parent e510dd64f1
commit 5cb8749ae3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -264,11 +264,9 @@ async def async_get_integration_descriptions(
core_flows: dict[str, Any] = json_loads(flow) core_flows: dict[str, Any] = json_loads(flow)
custom_integrations = await async_get_custom_components(hass) custom_integrations = await async_get_custom_components(hass)
custom_flows: dict[str, Any] = { custom_flows: dict[str, Any] = {
"device": {}, "integration": {},
"hardware": {}, "hardware": {},
"helper": {}, "helper": {},
"hub": {},
"service": {},
} }
for integration in custom_integrations.values(): for integration in custom_integrations.values():
@ -276,20 +274,25 @@ async def async_get_integration_descriptions(
if integration.integration_type in ("entity", "system"): if integration.integration_type in ("entity", "system"):
continue continue
for integration_type in ("device", "hardware", "helper", "hub", "service"): for integration_type in ("integration", "hardware", "helper"):
if integration.domain not in core_flows[integration_type]: if integration.domain not in core_flows[integration_type]:
continue continue
del core_flows[integration_type][integration.domain] del core_flows[integration_type][integration.domain]
if integration.domain in core_flows["translated_name"]: if integration.domain in core_flows["translated_name"]:
core_flows["translated_name"].remove(integration.domain) core_flows["translated_name"].remove(integration.domain)
if integration.integration_type in ("hardware", "helper"):
integration_key: str = integration.integration_type
else:
integration_key = "integration"
metadata = { metadata = {
"config_flow": integration.config_flow, "config_flow": integration.config_flow,
"integration_type": integration.integration_type, "integration_type": integration.integration_type,
"iot_class": integration.iot_class, "iot_class": integration.iot_class,
"name": integration.name, "name": integration.name,
} }
custom_flows[integration.integration_type][integration.domain] = metadata custom_flows[integration_key][integration.domain] = metadata
return {"core": core_flows, "custom": custom_flows} return {"core": core_flows, "custom": custom_flows}