Add SetSynchronizationPoint fallback to onvif (#86400)

Co-authored-by: J. Nick Koston <nick@koston.org>
pull/91482/head
Meow 2023-04-15 21:41:34 +02:00 committed by GitHub
parent 72dfd95831
commit 963648a333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -20,11 +20,9 @@ from .models import Event
from .parsers import PARSERS
UNHANDLED_TOPICS: set[str] = set()
SUBSCRIPTION_ERRORS = (
Fault,
asyncio.TimeoutError,
TransportError,
)
SUBSCRIPTION_ERRORS = (Fault, asyncio.TimeoutError, TransportError)
SET_SYNCHRONIZATION_POINT_ERRORS = (*SUBSCRIPTION_ERRORS, TypeError)
def _stringify_onvif_error(error: Exception) -> str:
@ -110,7 +108,7 @@ class EventManager:
# Initialize events
pullpoint = self.device.create_pullpoint_service()
with suppress(*SUBSCRIPTION_ERRORS):
with suppress(*SET_SYNCHRONIZATION_POINT_ERRORS):
await pullpoint.SetSynchronizationPoint()
response = await pullpoint.PullMessages(
{"MessageLimit": 100, "Timeout": dt.timedelta(seconds=5)}