From 3088a62c63cb91c8af586f79fce64b965e3337f4 Mon Sep 17 00:00:00 2001 From: Tucker Kern Date: Fri, 8 Nov 2024 23:11:38 +0000 Subject: [PATCH] Use local dashboard object in MDNSStatus --- esphome/dashboard/core.py | 2 +- esphome/dashboard/status/mdns.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/esphome/dashboard/core.py b/esphome/dashboard/core.py index 2846677cfa..563ca1506d 100644 --- a/esphome/dashboard/core.py +++ b/esphome/dashboard/core.py @@ -136,7 +136,7 @@ class ESPHomeDashboard: else: from .status.mdns import MDNSStatus - mdns_status = MDNSStatus(settings.zeroconf_default_interface) + mdns_status = MDNSStatus() await mdns_status.async_refresh_hosts() self.mdns_status = mdns_status mdns_task = asyncio.create_task(mdns_status.async_run()) diff --git a/esphome/dashboard/status/mdns.py b/esphome/dashboard/status/mdns.py index 526674129b..551477f034 100644 --- a/esphome/dashboard/status/mdns.py +++ b/esphome/dashboard/status/mdns.py @@ -18,11 +18,10 @@ from ..entries import DashboardEntry, bool_to_entry_state class MDNSStatus: """Class that updates the mdns status.""" - def __init__(self, default_interface=False) -> None: + def __init__(self) -> None: """Initialize the MDNSStatus class.""" super().__init__() self.aiozc: AsyncEsphomeZeroconf | None = None - self._zc_default_interface: bool = default_interface # This is the current mdns state for each host (True, False, None) self.host_mdns_state: dict[str, bool | None] = {} self._loop = asyncio.get_running_loop() @@ -65,7 +64,9 @@ class MDNSStatus: async def async_run(self) -> None: dashboard = DASHBOARD entries = dashboard.entries - aiozc = AsyncEsphomeZeroconf(default_interface=self._zc_default_interface) + aiozc = AsyncEsphomeZeroconf( + default_interface=dashboard.settings.zeroconf_default_interface + ) self.aiozc = aiozc host_mdns_state = self.host_mdns_state