Allow specifying discovery without a config flow (#54677)

This commit is contained in:
Paulus Schoutsen 2021-08-16 07:28:26 -07:00 committed by GitHub
parent c5d88d3e2f
commit 512a474e93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 41 deletions

View file

@ -4,5 +4,10 @@
"documentation": "https://www.home-assistant.io/integrations/rainforest_eagle",
"requirements": ["eagle200_reader==0.2.4", "uEagle==0.0.2"],
"codeowners": ["@gtdiehl", "@jcalbert"],
"iot_class": "local_polling"
"iot_class": "local_polling",
"dhcp": [
{
"macaddress": "D8D5B9*"
}
]
}

View file

@ -29,31 +29,6 @@ def validate_integration(config: Config, integration: Integration):
"config_flow",
"Config flows need to be defined in the file config_flow.py",
)
if integration.manifest.get("homekit"):
integration.add_error(
"config_flow",
"HomeKit information in a manifest requires a config flow to exist",
)
if integration.manifest.get("mqtt"):
integration.add_error(
"config_flow",
"MQTT information in a manifest requires a config flow to exist",
)
if integration.manifest.get("ssdp"):
integration.add_error(
"config_flow",
"SSDP information in a manifest requires a config flow to exist",
)
if integration.manifest.get("zeroconf"):
integration.add_error(
"config_flow",
"Zeroconf information in a manifest requires a config flow to exist",
)
if integration.manifest.get("dhcp"):
integration.add_error(
"config_flow",
"DHCP information in a manifest requires a config flow to exist",
)
return
config_flow = config_flow_file.read_text()
@ -98,17 +73,7 @@ def generate_and_validate(integrations: dict[str, Integration], config: Config):
for domain in sorted(integrations):
integration = integrations[domain]
if not integration.manifest:
continue
if not (
integration.manifest.get("config_flow")
or integration.manifest.get("homekit")
or integration.manifest.get("mqtt")
or integration.manifest.get("ssdp")
or integration.manifest.get("zeroconf")
or integration.manifest.get("dhcp")
):
if not integration.manifest or not integration.config_flow:
continue
validate_integration(config, integration)

View file

@ -24,7 +24,7 @@ def generate_and_validate(integrations: list[dict[str, str]]):
for domain in sorted(integrations):
integration = integrations[domain]
if not integration.manifest:
if not integration.manifest or not integration.config_flow:
continue
match_types = integration.manifest.get("dhcp", [])

View file

@ -96,6 +96,11 @@ class Integration:
"""Return quality scale of the integration."""
return self.manifest.get("quality_scale")
@property
def config_flow(self) -> str:
"""Return if the integration has a config flow."""
return self.manifest.get("config_flow")
@property
def requirements(self) -> list[str]:
"""List of requirements."""

View file

@ -26,7 +26,7 @@ def generate_and_validate(integrations: dict[str, Integration]):
for domain in sorted(integrations):
integration = integrations[domain]
if not integration.manifest:
if not integration.manifest or not integration.config_flow:
continue
mqtt = integration.manifest.get("mqtt")

View file

@ -31,7 +31,7 @@ def generate_and_validate(integrations: dict[str, Integration]):
for domain in sorted(integrations):
integration = integrations[domain]
if not integration.manifest:
if not integration.manifest or not integration.config_flow:
continue
ssdp = integration.manifest.get("ssdp")

View file

@ -28,7 +28,7 @@ def generate_and_validate(integrations: dict[str, Integration]):
for domain in sorted(integrations):
integration = integrations[domain]
if not integration.manifest:
if not integration.manifest or not integration.config_flow:
continue
service_types = integration.manifest.get("zeroconf", [])