From f6256901f96a07c0b79c58ee529b6795e249a7cf Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Sat, 2 Jul 2022 13:00:12 -0600 Subject: [PATCH] dial: Don't attempt resolve if zeroconf loop isn't running zeroconf asserts that the loop is running, so if we call this function without the loop running, it will hit the assert. Closes #641. --- pychromecast/dial.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pychromecast/dial.py b/pychromecast/dial.py index 32dfae2ed..846354d90 100644 --- a/pychromecast/dial.py +++ b/pychromecast/dial.py @@ -35,7 +35,8 @@ def get_host_from_service(service, zconf): return service.data + (None,) try: - service_info = zconf.get_service_info("_googlecast._tcp.local.", service.data) + if zconf.loop.is_running(): + service_info = zconf.get_service_info("_googlecast._tcp.local.", service.data) if service_info: _LOGGER.debug( "get_info_from_service resolved service %s to service_info %s",