2021-03-30 16:48:04 +00:00
|
|
|
"""Models for Zeroconf."""
|
|
|
|
|
2023-12-18 13:11:06 +00:00
|
|
|
from zeroconf import Zeroconf
|
|
|
|
from zeroconf.asyncio import AsyncZeroconf
|
2021-03-30 16:48:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
class HaZeroconf(Zeroconf):
|
|
|
|
"""Zeroconf that cannot be closed."""
|
|
|
|
|
|
|
|
def close(self) -> None:
|
|
|
|
"""Fake method to avoid integrations closing it."""
|
|
|
|
|
|
|
|
ha_close = Zeroconf.close
|
|
|
|
|
|
|
|
|
2021-05-11 16:03:36 +00:00
|
|
|
class HaAsyncZeroconf(AsyncZeroconf):
|
|
|
|
"""Home Assistant version of AsyncZeroconf."""
|
|
|
|
|
|
|
|
async def async_close(self) -> None:
|
|
|
|
"""Fake method to avoid integrations closing it."""
|
|
|
|
|
2021-06-30 03:13:31 +00:00
|
|
|
ha_async_close = AsyncZeroconf.async_close
|