mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 21:44:55 +01:00
add rp2040 support to the wizard (#6239)
This commit is contained in:
parent
91e7a44c31
commit
b9bb3cd4be
1 changed files with 64 additions and 51 deletions
|
@ -277,6 +277,7 @@ def wizard(path):
|
||||||
from esphome.components.esp32 import boards as esp32_boards
|
from esphome.components.esp32 import boards as esp32_boards
|
||||||
from esphome.components.esp8266 import boards as esp8266_boards
|
from esphome.components.esp8266 import boards as esp8266_boards
|
||||||
from esphome.components.rtl87xx import boards as rtl87xx_boards
|
from esphome.components.rtl87xx import boards as rtl87xx_boards
|
||||||
|
from esphome.components.rp2040 import boards as rp2040_boards
|
||||||
|
|
||||||
if not path.endswith(".yaml") and not path.endswith(".yml"):
|
if not path.endswith(".yaml") and not path.endswith(".yml"):
|
||||||
safe_print(
|
safe_print(
|
||||||
|
@ -343,7 +344,7 @@ def wizard(path):
|
||||||
"firmwares for it."
|
"firmwares for it."
|
||||||
)
|
)
|
||||||
|
|
||||||
wizard_platforms = ["ESP32", "ESP8266", "BK72XX", "RTL87XX"]
|
wizard_platforms = ["ESP32", "ESP8266", "BK72XX", "RTL87XX", "RP2040"]
|
||||||
safe_print(
|
safe_print(
|
||||||
"Please choose one of the supported microcontrollers "
|
"Please choose one of the supported microcontrollers "
|
||||||
"(Use ESP8266 for Sonoff devices)."
|
"(Use ESP8266 for Sonoff devices)."
|
||||||
|
@ -373,6 +374,10 @@ def wizard(path):
|
||||||
board_link = (
|
board_link = (
|
||||||
"http://docs.platformio.org/en/latest/platforms/espressif8266.html#boards"
|
"http://docs.platformio.org/en/latest/platforms/espressif8266.html#boards"
|
||||||
)
|
)
|
||||||
|
elif platform == "RP2040":
|
||||||
|
board_link = (
|
||||||
|
"https://www.raspberrypi.com/documentation/microcontrollers/rp2040.html"
|
||||||
|
)
|
||||||
elif platform in ["BK72XX", "RTL87XX"]:
|
elif platform in ["BK72XX", "RTL87XX"]:
|
||||||
board_link = "https://docs.libretiny.eu/docs/status/supported/"
|
board_link = "https://docs.libretiny.eu/docs/status/supported/"
|
||||||
else:
|
else:
|
||||||
|
@ -397,6 +402,10 @@ def wizard(path):
|
||||||
elif platform == "RTL87XX":
|
elif platform == "RTL87XX":
|
||||||
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'wr3')}\".")
|
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'wr3')}\".")
|
||||||
boards_list = rtl87xx_boards.BOARDS.items()
|
boards_list = rtl87xx_boards.BOARDS.items()
|
||||||
|
elif platform == "RP2040":
|
||||||
|
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'rpipicow')}\".")
|
||||||
|
boards_list = rp2040_boards.BOARDS.items()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("Unknown platform!")
|
raise NotImplementedError("Unknown platform!")
|
||||||
|
|
||||||
|
@ -423,60 +432,64 @@ def wizard(path):
|
||||||
safe_print()
|
safe_print()
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
||||||
safe_print_step(3, WIFI_BIG)
|
# Do not create wifi if the board does not support it
|
||||||
safe_print("In this step, I'm going to create the configuration for WiFi.")
|
if board not in ["rpipico"]:
|
||||||
safe_print()
|
safe_print_step(3, WIFI_BIG)
|
||||||
sleep(1)
|
safe_print("In this step, I'm going to create the configuration for WiFi.")
|
||||||
safe_print(
|
safe_print()
|
||||||
f"First, what's the {color(Fore.GREEN, 'SSID')} (the name) of the WiFi network {name} should connect to?"
|
sleep(1)
|
||||||
)
|
safe_print(
|
||||||
sleep(1.5)
|
f"First, what's the {color(Fore.GREEN, 'SSID')} (the name) of the WiFi network {name} should connect to?"
|
||||||
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'Abraham Linksys')}\".")
|
)
|
||||||
while True:
|
sleep(1.5)
|
||||||
ssid = safe_input(color(Fore.BOLD_WHITE, "(ssid): "))
|
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'Abraham Linksys')}\".")
|
||||||
try:
|
while True:
|
||||||
ssid = cv.ssid(ssid)
|
ssid = safe_input(color(Fore.BOLD_WHITE, "(ssid): "))
|
||||||
break
|
try:
|
||||||
except vol.Invalid:
|
ssid = cv.ssid(ssid)
|
||||||
safe_print(
|
break
|
||||||
color(
|
except vol.Invalid:
|
||||||
Fore.RED,
|
safe_print(
|
||||||
f'Unfortunately, "{ssid}" doesn\'t seem to be a valid SSID. Please try again.',
|
color(
|
||||||
|
Fore.RED,
|
||||||
|
f'Unfortunately, "{ssid}" doesn\'t seem to be a valid SSID. Please try again.',
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
safe_print()
|
||||||
safe_print()
|
sleep(1)
|
||||||
sleep(1)
|
|
||||||
|
|
||||||
safe_print(
|
safe_print(
|
||||||
f'Thank you very much! You\'ve just chosen "{color(Fore.CYAN, ssid)}" as your SSID.'
|
f'Thank you very much! You\'ve just chosen "{color(Fore.CYAN, ssid)}" as your SSID.'
|
||||||
)
|
)
|
||||||
safe_print()
|
safe_print()
|
||||||
sleep(0.75)
|
sleep(0.75)
|
||||||
|
|
||||||
safe_print(
|
safe_print(
|
||||||
f"Now please state the {color(Fore.GREEN, 'password')} of the WiFi network so that I can connect to it (Leave empty for no password)"
|
f"Now please state the {color(Fore.GREEN, 'password')} of the WiFi network so that I can connect to it (Leave empty for no password)"
|
||||||
)
|
)
|
||||||
safe_print()
|
safe_print()
|
||||||
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'PASSWORD42')}\"")
|
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'PASSWORD42')}\"")
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
psk = safe_input(color(Fore.BOLD_WHITE, "(PSK): "))
|
psk = safe_input(color(Fore.BOLD_WHITE, "(PSK): "))
|
||||||
safe_print(
|
safe_print(
|
||||||
"Perfect! WiFi is now set up (you can create static IPs and so on later)."
|
"Perfect! WiFi is now set up (you can create static IPs and so on later)."
|
||||||
)
|
)
|
||||||
sleep(1.5)
|
sleep(1.5)
|
||||||
|
|
||||||
safe_print_step(4, OTA_BIG)
|
safe_print_step(4, OTA_BIG)
|
||||||
safe_print(
|
safe_print(
|
||||||
"Almost there! ESPHome can automatically upload custom firmwares over WiFi "
|
"Almost there! ESPHome can automatically upload custom firmwares over WiFi "
|
||||||
"(over the air) and integrates into Home Assistant with a native API."
|
"(over the air) and integrates into Home Assistant with a native API."
|
||||||
)
|
)
|
||||||
safe_print(
|
safe_print(
|
||||||
f"This can be insecure if you do not trust the WiFi network. Do you want to set a {color(Fore.GREEN, 'password')} for connecting to this ESP?"
|
f"This can be insecure if you do not trust the WiFi network. Do you want to set a {color(Fore.GREEN, 'password')} for connecting to this ESP?"
|
||||||
)
|
)
|
||||||
safe_print()
|
safe_print()
|
||||||
sleep(0.25)
|
sleep(0.25)
|
||||||
safe_print("Press ENTER for no password")
|
safe_print("Press ENTER for no password")
|
||||||
password = safe_input(color(Fore.BOLD_WHITE, "(password): "))
|
password = safe_input(color(Fore.BOLD_WHITE, "(password): "))
|
||||||
|
else:
|
||||||
|
ssid, password, psk = "", "", ""
|
||||||
|
|
||||||
if not wizard_write(
|
if not wizard_write(
|
||||||
path=path,
|
path=path,
|
||||||
|
|
Loading…
Reference in a new issue