From ed7054cdb723d260eb40caab5d28827693b99e7b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 26 Aug 2025 18:20:38 -0500 Subject: [PATCH] Fix AttributeError when uploading OTA to offline OpenThread devices --- esphome/__main__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/esphome/__main__.py b/esphome/__main__.py index 8e8fc7d5d9..aab3035a5e 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -132,14 +132,17 @@ def choose_upload_log_host( ] resolved.append(choose_prompt(options, purpose=purpose)) elif device == "OTA": - if (show_ota and "ota" in CORE.config) or ( - show_api and "api" in CORE.config + if CORE.address and ( + (show_ota and "ota" in CORE.config) + or (show_api and "api" in CORE.config) ): resolved.append(CORE.address) elif show_mqtt and has_mqtt_logging(): resolved.append("MQTT") else: resolved.append(device) + if not resolved: + _LOGGER.error("All specified devices: %s could not be resolved.", defaults) return resolved # No devices specified, show interactive chooser