File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1111import socket
1212from typing import TYPE_CHECKING , Any , cast
1313
14- from zeroconf import IPVersion
14+ from zeroconf import DNSQuestionType , IPVersion
1515from zeroconf .asyncio import AsyncServiceInfo , AsyncZeroconf
1616
1717from .core import ResolveAPIError , ResolveTimeoutAPIError
@@ -66,7 +66,16 @@ async def _async_zeroconf_get_service_info(
6666) -> AsyncServiceInfo :
6767 info = _make_service_info_for_short_host (short_host )
6868 try :
69- await info .async_request (aiozc .zeroconf , int (timeout * 1000 ))
69+ # Use QM (multicast) questions to ensure multicast responses that all
70+ # zeroconf instances on the network can observe and cache. RFC 6762 Section
71+ # 5.4 specifies that responders SHOULD send multicast responses to QU
72+ # (unicast) questions if they haven't multicast recently (within 1/4 TTL),
73+ # but ESP32 mDNS doesn't implement this - it always sends unicast to QU.
74+ # By using QM, we ensure the dashboard observes responses when the CLI does
75+ # resolution, preventing the dashboard's cache from going stale.
76+ await info .async_request (
77+ aiozc .zeroconf , int (timeout * 1000 ), question_type = DNSQuestionType .QM
78+ )
7079 except Exception as exc :
7180 raise ResolveAPIError (
7281 f"Error resolving mDNS { short_host } via mDNS: { exc } "
You can’t perform that action at this time.
0 commit comments