ESPHome fix zeroconf add_listener issue (#57031)

This commit is contained in:
Otto Winter 2021-10-04 13:17:42 +02:00 committed by GitHub
parent 7446e388ed
commit da63a96273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -503,16 +503,14 @@ class ReconnectLogic(RecordUpdateListener):
"""
async with self._zc_lock:
if not self._zc_listening:
await self._hass.async_add_executor_job(
self._zc.add_listener, self, None
)
self._zc.async_add_listener(self, None)
self._zc_listening = True
async def _stop_zc_listen(self) -> None:
"""Stop listening for zeroconf updates."""
async with self._zc_lock:
if self._zc_listening:
await self._hass.async_add_executor_job(self._zc.remove_listener, self)
self._zc.async_remove_listener(self)
self._zc_listening = False
@callback