mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Reolink log fast poll errors once (#131203)
This commit is contained in:
parent
780eaa8379
commit
44ad8081a3
@ -110,6 +110,7 @@ class ReolinkHost:
|
|||||||
self._cancel_onvif_check: CALLBACK_TYPE | None = None
|
self._cancel_onvif_check: CALLBACK_TYPE | None = None
|
||||||
self._cancel_long_poll_check: CALLBACK_TYPE | None = None
|
self._cancel_long_poll_check: CALLBACK_TYPE | None = None
|
||||||
self._poll_job = HassJob(self._async_poll_all_motion, cancel_on_shutdown=True)
|
self._poll_job = HassJob(self._async_poll_all_motion, cancel_on_shutdown=True)
|
||||||
|
self._fast_poll_error: bool = False
|
||||||
self._long_poll_task: asyncio.Task | None = None
|
self._long_poll_task: asyncio.Task | None = None
|
||||||
self._lost_subscription: bool = False
|
self._lost_subscription: bool = False
|
||||||
|
|
||||||
@ -699,14 +700,20 @@ class ReolinkHost:
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if self._api.session_active:
|
||||||
await self._api.get_motion_state_all_ch()
|
await self._api.get_motion_state_all_ch()
|
||||||
except ReolinkError as err:
|
except ReolinkError as err:
|
||||||
|
if not self._fast_poll_error:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Reolink error while polling motion state for host %s:%s: %s",
|
"Reolink error while polling motion state for host %s:%s: %s",
|
||||||
self._api.host,
|
self._api.host,
|
||||||
self._api.port,
|
self._api.port,
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
|
self._fast_poll_error = True
|
||||||
|
else:
|
||||||
|
if self._api.session_active:
|
||||||
|
self._fast_poll_error = False
|
||||||
finally:
|
finally:
|
||||||
# schedule next poll
|
# schedule next poll
|
||||||
if not self._hass.is_stopping:
|
if not self._hass.is_stopping:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user