1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-06 21:32:21 +01:00

Packages feature (#1052)

* Started to work on packages feature

* Added some more validation to packages config

* Fixed some linter warnings

* Updated tests

* Reordered consts to avoid linter error

* Reordered consts to avoid linter error

* Refactored test yaml files to integrate into existing test pipeline

Co-authored-by: Dmitry Berezovsky <dmitry.berezovsky@logicify.com>
This commit is contained in:
Dmitry Berezovsky
2020-07-13 17:45:06 +03:00
committed by GitHub
parent 582ac4ac81
commit e6f42fa6f0
10 changed files with 85 additions and 1 deletions

View File

@@ -12,8 +12,9 @@ import voluptuous as vol
from esphome import core, core_config, yaml_util
from esphome.components import substitutions
from esphome.components.packages import do_packages_pass
from esphome.components.substitutions import CONF_SUBSTITUTIONS
from esphome.const import CONF_ESPHOME, CONF_PLATFORM, ESP_PLATFORMS
from esphome.const import CONF_ESPHOME, CONF_PLATFORM, ESP_PLATFORMS, CONF_PACKAGES
from esphome.core import CORE, EsphomeError # noqa
from esphome.helpers import color, indent
from esphome.util import safe_print, OrderedDict
@@ -390,6 +391,16 @@ def recursive_check_replaceme(value):
def validate_config(config, command_line_substitutions):
result = Config()
# 0. Load packages
if CONF_PACKAGES in config:
result.add_output_path([CONF_PACKAGES], CONF_PACKAGES)
try:
do_packages_pass(config)
except vol.Invalid as err:
result.update(config)
result.add_error(err)
return result
# 1. Load substitutions
if CONF_SUBSTITUTIONS in config:
result[CONF_SUBSTITUTIONS] = {**config[CONF_SUBSTITUTIONS], **command_line_substitutions}