Home Assistant Unofficial Reference 2024.12.1
models.py
Go to the documentation of this file.
1 """Models for Zeroconf."""
2 
3 from zeroconf import Zeroconf
4 from zeroconf.asyncio import AsyncZeroconf
5 
6 
7 class HaZeroconf(Zeroconf):
8  """Zeroconf that cannot be closed."""
9 
10  def close(self) -> None:
11  """Fake method to avoid integrations closing it."""
12 
13  ha_close = Zeroconf.close
14 
15 
16 class HaAsyncZeroconf(AsyncZeroconf):
17  """Home Assistant version of AsyncZeroconf."""
18 
19  async def async_close(self) -> None:
20  """Fake method to avoid integrations closing it."""
21 
22  ha_async_close = AsyncZeroconf.async_close