Fix ONVIF subscription errors (#81965)

fixes undefined
This commit is contained in:
Diogo Gomes 2022-11-16 11:51:14 +00:00 committed by Franck Nijhof
parent 8f3449d942
commit 0457a74428
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -8,7 +8,7 @@ import datetime as dt
from httpx import RemoteProtocolError, TransportError from httpx import RemoteProtocolError, TransportError
from onvif import ONVIFCamera, ONVIFService from onvif import ONVIFCamera, ONVIFService
from zeep.exceptions import Fault from zeep.exceptions import Fault, XMLParseError
from homeassistant.core import CALLBACK_TYPE, CoreState, HomeAssistant, callback from homeassistant.core import CALLBACK_TYPE, CoreState, HomeAssistant, callback
from homeassistant.helpers.event import async_call_later from homeassistant.helpers.event import async_call_later
@ -20,6 +20,7 @@ from .parsers import PARSERS
UNHANDLED_TOPICS = set() UNHANDLED_TOPICS = set()
SUBSCRIPTION_ERRORS = ( SUBSCRIPTION_ERRORS = (
XMLParseError,
Fault, Fault,
asyncio.TimeoutError, asyncio.TimeoutError,
TransportError, TransportError,
@ -153,7 +154,8 @@ class EventManager:
.isoformat(timespec="seconds") .isoformat(timespec="seconds")
.replace("+00:00", "Z") .replace("+00:00", "Z")
) )
await self._subscription.Renew(termination_time) with suppress(*SUBSCRIPTION_ERRORS):
await self._subscription.Renew(termination_time)
def async_schedule_pull(self) -> None: def async_schedule_pull(self) -> None:
"""Schedule async_pull_messages to run.""" """Schedule async_pull_messages to run."""