mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Additional checks for ONVIF event capabilities (#35599)
catch any exceptions when pulling event capabilities and assume it is not supported
This commit is contained in:
parent
99d3046a5b
commit
7ab19bdfcc
@ -209,17 +209,23 @@ class ONVIFDevice:
|
|||||||
"""Obtain information about the available services on the device."""
|
"""Obtain information about the available services on the device."""
|
||||||
media_service = self.device.create_media_service()
|
media_service = self.device.create_media_service()
|
||||||
media_capabilities = await media_service.GetServiceCapabilities()
|
media_capabilities = await media_service.GetServiceCapabilities()
|
||||||
|
|
||||||
|
pullpoint = False
|
||||||
|
try:
|
||||||
event_service = self.device.create_events_service()
|
event_service = self.device.create_events_service()
|
||||||
event_capabilities = await event_service.GetServiceCapabilities()
|
event_capabilities = await event_service.GetServiceCapabilities()
|
||||||
|
pullpoint = event_capabilities.WSPullPointSupport
|
||||||
|
except (ONVIFError, Fault):
|
||||||
|
pass
|
||||||
|
|
||||||
ptz = False
|
ptz = False
|
||||||
try:
|
try:
|
||||||
self.device.get_definition("ptz")
|
self.device.get_definition("ptz")
|
||||||
ptz = True
|
ptz = True
|
||||||
except ONVIFError:
|
except ONVIFError:
|
||||||
pass
|
pass
|
||||||
return Capabilities(
|
|
||||||
media_capabilities.SnapshotUri, event_capabilities.WSPullPointSupport, ptz
|
return Capabilities(media_capabilities.SnapshotUri, pullpoint, ptz)
|
||||||
)
|
|
||||||
|
|
||||||
async def async_get_profiles(self) -> List[Profile]:
|
async def async_get_profiles(self) -> List[Profile]:
|
||||||
"""Obtain media profiles for this device."""
|
"""Obtain media profiles for this device."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user