Check minimum amount of integrations for a brand (#124310)

pull/124449/head
Joost Lekkerkerker 2024-08-22 21:01:48 +02:00 committed by GitHub
parent 1d35c745bb
commit 281a9f042b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -18,6 +18,8 @@ BRAND_SCHEMA = vol.Schema(
}
)
BRAND_EXCEPTIONS = ["u_tec"]
def _validate_brand(
brand: Brand, integrations: dict[str, Integration], config: Config
@ -38,10 +40,14 @@ def _validate_brand(
f"Domain '{brand.domain}' does not match file name {brand.path.name}",
)
if not brand.integrations and not brand.iot_standards:
if (
len(brand.integrations) < 2
and not brand.iot_standards
and brand.domain not in BRAND_EXCEPTIONS
):
config.add_error(
"brand",
f"{brand.path.name}: At least one of integrations or "
f"{brand.path.name}: At least two integrations or "
"iot_standards must be non-empty",
)