mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add SetSynchronizationPoint fallback to onvif (#86400)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
b5ac3ee288
commit
47398f03dd
@ -20,11 +20,9 @@ from .models import Event
|
|||||||
from .parsers import PARSERS
|
from .parsers import PARSERS
|
||||||
|
|
||||||
UNHANDLED_TOPICS: set[str] = set()
|
UNHANDLED_TOPICS: set[str] = set()
|
||||||
SUBSCRIPTION_ERRORS = (
|
|
||||||
Fault,
|
SUBSCRIPTION_ERRORS = (Fault, asyncio.TimeoutError, TransportError)
|
||||||
asyncio.TimeoutError,
|
SET_SYNCHRONIZATION_POINT_ERRORS = (*SUBSCRIPTION_ERRORS, TypeError)
|
||||||
TransportError,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _stringify_onvif_error(error: Exception) -> str:
|
def _stringify_onvif_error(error: Exception) -> str:
|
||||||
@ -99,7 +97,7 @@ class EventManager:
|
|||||||
|
|
||||||
# Initialize events
|
# Initialize events
|
||||||
pullpoint = self.device.create_pullpoint_service()
|
pullpoint = self.device.create_pullpoint_service()
|
||||||
with suppress(*SUBSCRIPTION_ERRORS):
|
with suppress(*SET_SYNCHRONIZATION_POINT_ERRORS):
|
||||||
await pullpoint.SetSynchronizationPoint()
|
await pullpoint.SetSynchronizationPoint()
|
||||||
response = await pullpoint.PullMessages(
|
response = await pullpoint.PullMessages(
|
||||||
{"MessageLimit": 100, "Timeout": dt.timedelta(seconds=5)}
|
{"MessageLimit": 100, "Timeout": dt.timedelta(seconds=5)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user