From 68affe0b9c0c99f91c1e3ee456c1d233bad20607 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 15 Jan 2026 18:55:32 -1000 Subject: [PATCH 1/2] [core] Add --device hint when DNS resolution fails (#13240) --- esphome/__main__.py | 7 ++++++- esphome/espota2.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/esphome/__main__.py b/esphome/__main__.py index 3849a585ca..545464be10 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -222,8 +222,13 @@ def choose_upload_log_host( else: resolved.append(device) if not resolved: + if CORE.dashboard: + hint = "If you know the IP, set 'use_address' in your network config." + else: + hint = "If you know the IP, try --device " raise EsphomeError( - f"All specified devices {defaults} could not be resolved. Is the device connected to the network?" + f"All specified devices {defaults} could not be resolved. " + f"Is the device connected to the network? {hint}" ) return resolved diff --git a/esphome/espota2.py b/esphome/espota2.py index 6349ad0fa8..95dd602ad2 100644 --- a/esphome/espota2.py +++ b/esphome/espota2.py @@ -400,6 +400,8 @@ def run_ota_impl_( "Error resolving IP address of %s. Is it connected to WiFi?", remote_host, ) + if not CORE.dashboard: + _LOGGER.error("(If you know the IP, try --device )") _LOGGER.error( "(If this error persists, please set a static IP address: " "https://esphome.io/components/wifi/#manual-ips)" From 638de5da46de245bf6b1d9420ca0df18394fda53 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 15 Jan 2026 19:13:24 -1000 Subject: [PATCH 2/2] [mqtt] Replace sprintf with snprintf for friendly name hash --- esphome/components/mqtt/mqtt_component.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esphome/components/mqtt/mqtt_component.cpp b/esphome/components/mqtt/mqtt_component.cpp index 20c111de43..8e4b3437ab 100644 --- a/esphome/components/mqtt/mqtt_component.cpp +++ b/esphome/components/mqtt/mqtt_component.cpp @@ -189,8 +189,7 @@ bool MQTTComponent::send_discovery_() { StringRef object_id = this->get_default_object_id_to_(object_id_buf); if (discovery_info.unique_id_generator == MQTT_MAC_ADDRESS_UNIQUE_ID_GENERATOR) { char friendly_name_hash[9]; - sprintf(friendly_name_hash, "%08" PRIx32, fnv1_hash(this->friendly_name_())); - friendly_name_hash[8] = 0; // ensure the hash-string ends with null + snprintf(friendly_name_hash, sizeof(friendly_name_hash), "%08" PRIx32, fnv1_hash(this->friendly_name_())); // Format: mac-component_type-hash (e.g. "aabbccddeeff-sensor-12345678") // MAC (12) + "-" (1) + domain (max 20) + "-" (1) + hash (8) + null (1) = 43 char unique_id[MAC_ADDRESS_BUFFER_SIZE + ESPHOME_DOMAIN_MAX_LEN + 11];