mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 00:18:11 +01:00
Fix dashboard imports for adoption (#2684)
This commit is contained in:
parent
f72389147d
commit
d6717c0032
1 changed files with 17 additions and 2 deletions
|
@ -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",
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue