mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +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:
|
else:
|
||||||
from .status.mdns import MDNSStatus
|
from .status.mdns import MDNSStatus
|
||||||
|
|
||||||
mdns_status = MDNSStatus(settings.zeroconf_default_interface)
|
mdns_status = MDNSStatus()
|
||||||
await mdns_status.async_refresh_hosts()
|
await mdns_status.async_refresh_hosts()
|
||||||
self.mdns_status = mdns_status
|
self.mdns_status = mdns_status
|
||||||
mdns_task = asyncio.create_task(mdns_status.async_run())
|
mdns_task = asyncio.create_task(mdns_status.async_run())
|
||||||
|
|
|
@ -18,11 +18,10 @@ from ..entries import DashboardEntry, bool_to_entry_state
|
||||||
class MDNSStatus:
|
class MDNSStatus:
|
||||||
"""Class that updates the mdns status."""
|
"""Class that updates the mdns status."""
|
||||||
|
|
||||||
def __init__(self, default_interface=False) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize the MDNSStatus class."""
|
"""Initialize the MDNSStatus class."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.aiozc: AsyncEsphomeZeroconf | None = None
|
self.aiozc: AsyncEsphomeZeroconf | None = None
|
||||||
self._zc_default_interface: bool = default_interface
|
|
||||||
# This is the current mdns state for each host (True, False, None)
|
# This is the current mdns state for each host (True, False, None)
|
||||||
self.host_mdns_state: dict[str, bool | None] = {}
|
self.host_mdns_state: dict[str, bool | None] = {}
|
||||||
self._loop = asyncio.get_running_loop()
|
self._loop = asyncio.get_running_loop()
|
||||||
|
@ -65,7 +64,9 @@ class MDNSStatus:
|
||||||
async def async_run(self) -> None:
|
async def async_run(self) -> None:
|
||||||
dashboard = DASHBOARD
|
dashboard = DASHBOARD
|
||||||
entries = dashboard.entries
|
entries = dashboard.entries
|
||||||
aiozc = AsyncEsphomeZeroconf(default_interface=self._zc_default_interface)
|
aiozc = AsyncEsphomeZeroconf(
|
||||||
|
default_interface=dashboard.settings.zeroconf_default_interface
|
||||||
|
)
|
||||||
self.aiozc = aiozc
|
self.aiozc = aiozc
|
||||||
host_mdns_state = self.host_mdns_state
|
host_mdns_state = self.host_mdns_state
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue