From 661101df08e36ab33f4f4418faf4f3395b07be5b Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 20 Mar 2020 16:17:43 +0100 Subject: [PATCH] Fix packages for schemas without a default (#33045) --- homeassistant/components/person/__init__.py | 6 +++++- homeassistant/config.py | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/person/__init__.py b/homeassistant/components/person/__init__.py index 9cd3e882c48..006929c7345 100644 --- a/homeassistant/components/person/__init__.py +++ b/homeassistant/components/person/__init__.py @@ -77,7 +77,11 @@ PERSON_SCHEMA = vol.Schema( ) CONFIG_SCHEMA = vol.Schema( - {vol.Optional(DOMAIN): vol.All(cv.ensure_list, cv.remove_falsy, [PERSON_SCHEMA])}, + { + vol.Optional(DOMAIN, default=[]): vol.All( + cv.ensure_list, cv.remove_falsy, [PERSON_SCHEMA] + ) + }, extra=vol.ALLOW_EXTRA, ) diff --git a/homeassistant/config.py b/homeassistant/config.py index 27aff8ca36b..b1cd49b0852 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -571,7 +571,9 @@ def _identify_config_schema(module: ModuleType) -> Tuple[Optional[str], Optional schema = module.CONFIG_SCHEMA.schema[key] # type: ignore - if hasattr(key, "default"): + if hasattr(key, "default") and not isinstance( + key.default, vol.schema_builder.Undefined + ): default_value = schema(key.default()) if isinstance(default_value, dict):