From b83adad4179aabd2c4707b014ca5c505faabb22f Mon Sep 17 00:00:00 2001 From: Jason Hunter Date: Wed, 13 May 2020 22:24:38 -0400 Subject: [PATCH] Additional checks for ONVIF event capabilities (#35599) catch any exceptions when pulling event capabilities and assume it is not supported --- homeassistant/components/onvif/device.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/onvif/device.py b/homeassistant/components/onvif/device.py index 2743ed7eca4..17a0c0c27f0 100644 --- a/homeassistant/components/onvif/device.py +++ b/homeassistant/components/onvif/device.py @@ -209,17 +209,23 @@ class ONVIFDevice: """Obtain information about the available services on the device.""" media_service = self.device.create_media_service() media_capabilities = await media_service.GetServiceCapabilities() - event_service = self.device.create_events_service() - event_capabilities = await event_service.GetServiceCapabilities() + + pullpoint = False + try: + event_service = self.device.create_events_service() + event_capabilities = await event_service.GetServiceCapabilities() + pullpoint = event_capabilities.WSPullPointSupport + except (ONVIFError, Fault): + pass + ptz = False try: self.device.get_definition("ptz") ptz = True except ONVIFError: 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]: """Obtain media profiles for this device."""