1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-30 09:02:17 +01:00

Fix dashboard dns lookup delay

This commit is contained in:
J. Nick Koston
2025-09-11 18:25:06 -05:00
parent 519bc5ef9e
commit bc9d16289e
3 changed files with 53 additions and 4 deletions

View File

@@ -6,6 +6,9 @@ import os
import re
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from esphome.address_cache import AddressCache
from esphome.const import (
CONF_COMMENT,
CONF_ESPHOME,
@@ -584,7 +587,7 @@ class EsphomeCore:
# The current component being processed during validation
self.current_component: str | None = None
# Address cache for DNS and mDNS lookups from command line arguments
self.address_cache: object | None = None
self.address_cache: AddressCache | None = None
def reset(self):
from esphome.pins import PIN_SCHEMA_REGISTRY

View File

@@ -364,14 +364,16 @@ class EsphomePortCommandWebSocket(EsphomeCommandWebSocket):
addresses.extend(sort_ip_addresses(cached))
dns_cache_entries[entry.name] = set(cached)
# Build cache arguments to pass to CLI
# Build cache arguments to pass to CLI (normalize hostnames)
for hostname, addrs in dns_cache_entries.items():
normalized = hostname.rstrip(".").lower()
cache_args.extend(
["--dns-lookup-cache", f"{hostname}={','.join(sorted(addrs))}"]
["--dns-lookup-cache", f"{normalized}={','.join(sorted(addrs))}"]
)
for hostname, addrs in mdns_cache_entries.items():
normalized = hostname.rstrip(".").lower()
cache_args.extend(
["--mdns-lookup-cache", f"{hostname}={','.join(sorted(addrs))}"]
["--mdns-lookup-cache", f"{normalized}={','.join(sorted(addrs))}"]
)
if not addresses: