mirror of
https://github.com/esphome/esphome.git
synced 2024-11-12 18:27:46 +01:00
Use local dashboard object in MDNSStatus
This commit is contained in:
parent
d027dde769
commit
3088a62c63
2 changed files with 5 additions and 4 deletions
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue