1
0
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:
Jesse Hills
2021-12-08 09:22:03 +13:00
committed by GitHub
parent 6fe4ff7f85
commit 3d51ac8df0
2 changed files with 27 additions and 6 deletions

View File

@@ -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"