* Ensure we have valid config AFTER merging packages #13015 * also fix packages
This commit is contained in:
parent
7ea7fc8d38
commit
40485a6e89
3 changed files with 14 additions and 4 deletions
|
@ -113,15 +113,17 @@ def async_from_config_dict(config: Dict[str, Any],
|
|||
yield from hass.async_add_job(loader.prepare, hass)
|
||||
|
||||
# Make a copy because we are mutating it.
|
||||
new_config = OrderedDict()
|
||||
for key, value in config.items():
|
||||
new_config[key] = value or {}
|
||||
config = new_config
|
||||
config = OrderedDict(config)
|
||||
|
||||
# Merge packages
|
||||
conf_util.merge_packages_config(
|
||||
config, core_config.get(conf_util.CONF_PACKAGES, {}))
|
||||
|
||||
# Ensure we have no None values after merge
|
||||
for key, value in config.items():
|
||||
if not value:
|
||||
config[key] = {}
|
||||
|
||||
hass.config_entries = config_entries.ConfigEntries(hass, config)
|
||||
yield from hass.config_entries.async_load()
|
||||
|
||||
|
|
|
@ -562,6 +562,9 @@ def merge_packages_config(config, packages, _log_pkg_error=_log_pkg_error):
|
|||
continue
|
||||
|
||||
if merge_type == 'dict':
|
||||
if comp_conf is None:
|
||||
comp_conf = OrderedDict()
|
||||
|
||||
if not isinstance(comp_conf, dict):
|
||||
_log_pkg_error(
|
||||
pack_name, comp_name, config,
|
||||
|
|
|
@ -326,6 +326,11 @@ def check_ha_config_file(config_dir):
|
|||
config, core_config.get(CONF_PACKAGES, {}), _pack_error)
|
||||
del core_config[CONF_PACKAGES]
|
||||
|
||||
# Ensure we have no None values after merge
|
||||
for key, value in config.items():
|
||||
if not value:
|
||||
config[key] = {}
|
||||
|
||||
# Filter out repeating config sections
|
||||
components = set(key.split(' ')[0] for key in config.keys())
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue