1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-26 14:58:16 +00:00

[core] make upload_program more generic (#8321)

This commit is contained in:
tomaszduda23 2025-02-25 21:24:05 +01:00 committed by GitHub
parent 9448737a92
commit b7b2f3e61c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@
import argparse import argparse
from datetime import datetime from datetime import datetime
import functools import functools
import importlib
import logging import logging
import os import os
import re import re
@ -336,6 +337,13 @@ def check_permissions(port):
def upload_program(config, args, host): def upload_program(config, args, host):
try:
module = importlib.import_module("esphome.components." + CORE.target_platform)
if getattr(module, "upload_program")(config, args, host):
return 0
except AttributeError:
pass
if get_port_type(host) == "SERIAL": if get_port_type(host) == "SERIAL":
check_permissions(host) check_permissions(host)
if CORE.target_platform in (PLATFORM_ESP32, PLATFORM_ESP8266): if CORE.target_platform in (PLATFORM_ESP32, PLATFORM_ESP8266):