Fix dashboard imports for adoption (#2684)

This commit is contained in:
Jesse Hills 2021-11-10 08:38:20 +13:00 committed by GitHub
parent f72389147d
commit d6717c0032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 2 deletions

View File

@ -29,6 +29,14 @@ CONFIG_SCHEMA = cv.Schema(
}
)
WIFI_MESSAGE = """
# Do not forget to add your own wifi configuration before installing this configuration
# wifi:
# ssid: !secret wifi_ssid
# password: !secret wifi_password
"""
async def to_code(config):
cg.add_define("USE_DASHBOARD_IMPORT")
@ -41,5 +49,12 @@ def import_config(path: str, name: str, project_name: str, import_url: str) -> N
if p.exists():
raise FileExistsError
config = {"substitutions": {"name": name}, "packages": {project_name: import_url}}
p.write_text(dump(config), encoding="utf8")
config = {
"substitutions": {"name": name},
"packages": {project_name: import_url},
"esphome": {"name_add_mac_suffix": False},
}
p.write_text(
dump(config) + WIFI_MESSAGE,
encoding="utf8",
)