From 856087b7c133b04bb3a28868921ac9f09b6b5954 Mon Sep 17 00:00:00 2001 From: pszafer Date: Wed, 16 Oct 2024 10:36:08 +0200 Subject: [PATCH] proceed vars always, because of the defaults --- esphome/components/packages/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/packages/__init__.py b/esphome/components/packages/__init__.py index 65d061037c..31ddf5d50b 100644 --- a/esphome/components/packages/__init__.py +++ b/esphome/components/packages/__init__.py @@ -121,6 +121,7 @@ def _process_base_package(config: dict) -> dict: password=config.get(CONF_PASSWORD), ) files = [] + for file in config[CONF_FILES]: if isinstance(file, str): files.append({CONF_NAME: file, CONF_VARS: {}}) @@ -132,7 +133,7 @@ def _process_base_package(config: dict) -> dict: for idx, file in enumerate(files): filename = file[CONF_NAME] yaml_file: Path = repo_dir / filename - vars = file.get(CONF_VARS) + vars = file.get(CONF_VARS, {}) if not yaml_file.is_file(): raise cv.Invalid( @@ -153,9 +154,8 @@ def _process_base_package(config: dict) -> dict: raise cv.Invalid( 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()} - new_yaml = yaml_util.substitute_vars(new_yaml, vars) + vars = {k: str(v) for k, v in vars.items()} + new_yaml = yaml_util.substitute_vars(new_yaml, vars) packages[f"{filename}{idx}"] = new_yaml except EsphomeError as e: raise cv.Invalid(