mirror of
https://github.com/esphome/esphome.git
synced 2025-09-25 14:42:21 +01:00
Dont add wifi block to yaml if discovered device uses ethernet (#3882)
This commit is contained in:
@@ -3,6 +3,7 @@ from pathlib import Path
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components.packages import validate_source_shorthand
|
||||
from esphome.const import CONF_WIFI
|
||||
from esphome.wizard import wizard_file
|
||||
from esphome.yaml_util import dump
|
||||
|
||||
@@ -43,7 +44,9 @@ async def to_code(config):
|
||||
cg.add(dashboard_import_ns.set_package_import_url(config[CONF_PACKAGE_IMPORT_URL]))
|
||||
|
||||
|
||||
def import_config(path: str, name: str, project_name: str, import_url: str) -> None:
|
||||
def import_config(
|
||||
path: str, name: str, project_name: str, import_url: str, network: str = CONF_WIFI
|
||||
) -> None:
|
||||
p = Path(path)
|
||||
|
||||
if p.exists():
|
||||
@@ -69,7 +72,9 @@ def import_config(path: str, name: str, project_name: str, import_url: str) -> N
|
||||
"name_add_mac_suffix": False,
|
||||
},
|
||||
}
|
||||
p.write_text(
|
||||
dump(config) + WIFI_CONFIG,
|
||||
encoding="utf8",
|
||||
)
|
||||
output = dump(config)
|
||||
|
||||
if network == CONF_WIFI:
|
||||
output += WIFI_CONFIG
|
||||
|
||||
p.write_text(output, encoding="utf8")
|
||||
|
Reference in New Issue
Block a user