Perform merges when substituting dict keys (#3062)

This commit is contained in:
Joshua Spence
2022-01-25 09:46:42 +11:00
committed by GitHub
parent 6ff3942e8b
commit 28b65cb810
3 changed files with 24 additions and 22 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import esphome.config_validation as cv
from esphome import core
from esphome.const import CONF_SUBSTITUTIONS
from esphome.yaml_util import ESPHomeDataBase, make_data_base
from esphome.config_helpers import merge_config
CODEOWNERS = ["@esphome/core"]
_LOGGER = logging.getLogger(__name__)
@@ -108,7 +109,7 @@ def _substitute_item(substitutions, item, path):
if sub is not None:
item[k] = sub
for old, new in replace_keys:
item[new] = item[old]
item[new] = merge_config(item.get(old), item.get(new))
del item[old]
elif isinstance(item, str):
sub = _expand_substitutions(substitutions, item, path)