diff --git a/esphome/components/substitutions/__init__.py b/esphome/components/substitutions/__init__.py index c4bc1b4371..1cc5b50f47 100644 --- a/esphome/components/substitutions/__init__.py +++ b/esphome/components/substitutions/__init__.py @@ -136,4 +136,6 @@ def do_substitution_pass(config, command_line_substitutions): del substitutions[old] config[CONF_SUBSTITUTIONS] = substitutions + # Move substitutions to the first place to replace substitutions in them correctly + config.move_to_end(CONF_SUBSTITUTIONS, False) _substitute_item(substitutions, config, [])