1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-10 15:22:24 +01:00

Sort resolved IP addresses for dashboard (#8536)

Co-authored-by: J. Nick Koston <nick+github@koston.org>
This commit is contained in:
David Woodhouse
2025-04-17 02:19:55 +01:00
committed by GitHub
parent 4a65fd76b3
commit 3c7bb65a23
3 changed files with 52 additions and 3 deletions

View File

@@ -38,7 +38,7 @@ import yaml
from yaml.nodes import Node
from esphome import const, platformio_api, yaml_util
from esphome.helpers import get_bool_env, mkdir_p
from esphome.helpers import get_bool_env, mkdir_p, sort_ip_addresses
from esphome.storage_json import (
StorageJSON,
archive_storage_path,
@@ -336,7 +336,7 @@ class EsphomePortCommandWebSocket(EsphomeCommandWebSocket):
# Use the IP address if available but only
# if the API is loaded and the device is online
# since MQTT logging will not work otherwise
port = address_list[0]
port = sort_ip_addresses(address_list)[0]
elif (
entry.address
and (
@@ -347,7 +347,7 @@ class EsphomePortCommandWebSocket(EsphomeCommandWebSocket):
and not isinstance(address_list, Exception)
):
# If mdns is not available, try to use the DNS cache
port = address_list[0]
port = sort_ip_addresses(address_list)[0]
return [
*DASHBOARD_COMMAND,