From ecb59ff9437c90f5164b2387b6d46977e20641e4 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 28 Nov 2025 15:39:42 -0600 Subject: [PATCH] prevent crash when a camera doesn't support onvif imaging service required for focus support --- frigate/ptz/onvif.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/frigate/ptz/onvif.py b/frigate/ptz/onvif.py index 13faffc97..e7539b1d6 100644 --- a/frigate/ptz/onvif.py +++ b/frigate/ptz/onvif.py @@ -190,7 +190,11 @@ class OnvifController: ptz: ONVIFService = await onvif.create_ptz_service() self.cams[camera_name]["ptz"] = ptz - imaging: ONVIFService = await onvif.create_imaging_service() + try: + imaging: ONVIFService = await onvif.create_imaging_service() + except (Fault, ONVIFError, TransportError, Exception) as e: + logger.debug(f"Imaging service not supported for {camera_name}: {e}") + imaging = None self.cams[camera_name]["imaging"] = imaging try: video_sources = await media.GetVideoSources() @@ -381,7 +385,10 @@ class OnvifController: f"Disabling autotracking zooming for {camera_name}: Absolute zoom not supported. Exception: {e}" ) - if self.cams[camera_name]["video_source_token"] is not None: + if ( + self.cams[camera_name]["video_source_token"] is not None + and imaging is not None + ): try: imaging_capabilities = await imaging.GetImagingSettings( {"VideoSourceToken": self.cams[camera_name]["video_source_token"]} @@ -421,6 +428,7 @@ class OnvifController: if ( "focus" in self.cams[camera_name]["features"] and self.cams[camera_name]["video_source_token"] + and self.cams[camera_name]["imaging"] is not None ): try: stop_request = self.cams[camera_name]["imaging"].create_type("Stop") @@ -648,6 +656,7 @@ class OnvifController: if ( "focus" not in self.cams[camera_name]["features"] or not self.cams[camera_name]["video_source_token"] + or self.cams[camera_name]["imaging"] is None ): logger.error(f"{camera_name} does not support ONVIF continuous focus.") return