mirror of
https://github.com/esphome/esphome.git
synced 2025-07-29 06:36:45 +00:00
Increase zeroconf timeout to 10 seconds (#8670)
This commit is contained in:
parent
b01d85a974
commit
782d748210
@ -18,6 +18,8 @@ from esphome.storage_json import StorageJSON, ext_storage_path
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
DEFAULT_TIMEOUT = 10.0
|
||||||
|
DEFAULT_TIMEOUT_MS = DEFAULT_TIMEOUT * 1000
|
||||||
|
|
||||||
_BACKGROUND_TASKS: set[asyncio.Task] = set()
|
_BACKGROUND_TASKS: set[asyncio.Task] = set()
|
||||||
|
|
||||||
@ -107,7 +109,7 @@ class DashboardImportDiscovery:
|
|||||||
self, zeroconf: Zeroconf, info: AsyncServiceInfo, service_type: str, name: str
|
self, zeroconf: Zeroconf, info: AsyncServiceInfo, service_type: str, name: str
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Process a service info."""
|
"""Process a service info."""
|
||||||
if await info.async_request(zeroconf, timeout=3000):
|
if await info.async_request(zeroconf, timeout=DEFAULT_TIMEOUT_MS):
|
||||||
self._process_service_info(name, info)
|
self._process_service_info(name, info)
|
||||||
|
|
||||||
def _process_service_info(self, name: str, info: ServiceInfo) -> None:
|
def _process_service_info(self, name: str, info: ServiceInfo) -> None:
|
||||||
@ -164,7 +166,9 @@ class DashboardImportDiscovery:
|
|||||||
|
|
||||||
|
|
||||||
class EsphomeZeroconf(Zeroconf):
|
class EsphomeZeroconf(Zeroconf):
|
||||||
def resolve_host(self, host: str, timeout: float = 3.0) -> list[str] | None:
|
def resolve_host(
|
||||||
|
self, host: str, timeout: float = DEFAULT_TIMEOUT
|
||||||
|
) -> list[str] | None:
|
||||||
"""Resolve a host name to an IP address."""
|
"""Resolve a host name to an IP address."""
|
||||||
info = AddressResolver(f"{host.partition('.')[0]}.local.")
|
info = AddressResolver(f"{host.partition('.')[0]}.local.")
|
||||||
if (
|
if (
|
||||||
@ -177,7 +181,7 @@ class EsphomeZeroconf(Zeroconf):
|
|||||||
|
|
||||||
class AsyncEsphomeZeroconf(AsyncZeroconf):
|
class AsyncEsphomeZeroconf(AsyncZeroconf):
|
||||||
async def async_resolve_host(
|
async def async_resolve_host(
|
||||||
self, host: str, timeout: float = 3.0
|
self, host: str, timeout: float = DEFAULT_TIMEOUT
|
||||||
) -> list[str] | None:
|
) -> list[str] | None:
|
||||||
"""Resolve a host name to an IP address."""
|
"""Resolve a host name to an IP address."""
|
||||||
info = AddressResolver(f"{host.partition('.')[0]}.local.")
|
info = AddressResolver(f"{host.partition('.')[0]}.local.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user