proceed vars always, because of the defaults

This commit is contained in:
pszafer 2024-10-16 10:36:08 +02:00
parent 285e82e5fc
commit 856087b7c1

View file

@ -121,6 +121,7 @@ def _process_base_package(config: dict) -> dict:
password=config.get(CONF_PASSWORD), password=config.get(CONF_PASSWORD),
) )
files = [] files = []
for file in config[CONF_FILES]: for file in config[CONF_FILES]:
if isinstance(file, str): if isinstance(file, str):
files.append({CONF_NAME: file, CONF_VARS: {}}) files.append({CONF_NAME: file, CONF_VARS: {}})
@ -132,7 +133,7 @@ def _process_base_package(config: dict) -> dict:
for idx, file in enumerate(files): for idx, file in enumerate(files):
filename = file[CONF_NAME] filename = file[CONF_NAME]
yaml_file: Path = repo_dir / filename yaml_file: Path = repo_dir / filename
vars = file.get(CONF_VARS) vars = file.get(CONF_VARS, {})
if not yaml_file.is_file(): if not yaml_file.is_file():
raise cv.Invalid( raise cv.Invalid(
@ -153,7 +154,6 @@ def _process_base_package(config: dict) -> dict:
raise cv.Invalid( raise cv.Invalid(
f"Current ESPHome Version is too old to use this package: {ESPHOME_VERSION} < {min_version}" f"Current ESPHome Version is too old to use this package: {ESPHOME_VERSION} < {min_version}"
) )
if vars:
vars = {k: str(v) for k, v in vars.items()} vars = {k: str(v) for k, v in vars.items()}
new_yaml = yaml_util.substitute_vars(new_yaml, vars) new_yaml = yaml_util.substitute_vars(new_yaml, vars)
packages[f"{filename}{idx}"] = new_yaml packages[f"{filename}{idx}"] = new_yaml