mirror of
https://github.com/esphome/esphome.git
synced 2025-09-27 07:32:22 +01:00
Use new platform component config blocks for wizard (#2885)
This commit is contained in:
@@ -45,9 +45,9 @@ OTA_BIG = r""" ____ _______
|
||||
|
||||
BASE_CONFIG = """esphome:
|
||||
name: {name}
|
||||
platform: {platform}
|
||||
board: {board}
|
||||
"""
|
||||
|
||||
LOGGER_API_CONFIG = """
|
||||
# Enable logging
|
||||
logger:
|
||||
|
||||
@@ -55,6 +55,18 @@ logger:
|
||||
api:
|
||||
"""
|
||||
|
||||
ESP8266_CONFIG = """
|
||||
esp8266:
|
||||
board: {board}
|
||||
"""
|
||||
|
||||
ESP32_CONFIG = """
|
||||
esp32:
|
||||
board: {board}
|
||||
framework:
|
||||
type: arduino
|
||||
"""
|
||||
|
||||
|
||||
def sanitize_double_quotes(value):
|
||||
return value.replace("\\", "\\\\").replace('"', '\\"')
|
||||
@@ -71,6 +83,14 @@ def wizard_file(**kwargs):
|
||||
|
||||
config = BASE_CONFIG.format(**kwargs)
|
||||
|
||||
config += (
|
||||
ESP8266_CONFIG.format(**kwargs)
|
||||
if kwargs["platform"] == "ESP8266"
|
||||
else ESP32_CONFIG.format(**kwargs)
|
||||
)
|
||||
|
||||
config += LOGGER_API_CONFIG
|
||||
|
||||
# Configure API
|
||||
if "password" in kwargs:
|
||||
config += f" password: \"{kwargs['password']}\"\n"
|
||||
|
Reference in New Issue
Block a user