From bd2dda825f8eb0a703c79a818f06b296849c065d Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:56:57 -0600 Subject: [PATCH] error if profile remains unset --- frigate/ptz/onvif.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/frigate/ptz/onvif.py b/frigate/ptz/onvif.py index 8abbb3d48..1c97314c5 100644 --- a/frigate/ptz/onvif.py +++ b/frigate/ptz/onvif.py @@ -87,21 +87,24 @@ class OnvifController: ) return False + ptz = onvif.create_ptz_service() + + profile = None for key, onvif_profile in enumerate(profiles): - # skip non-H264 profiles if ( - not onvif_profile.VideoEncoderConfiguration - or onvif_profile.VideoEncoderConfiguration.Encoding != "H264" + onvif_profile.VideoEncoderConfiguration + and onvif_profile.VideoEncoderConfiguration.Encoding == "H264" ): - continue - else: - # use the first H264 profile profile = onvif_profile break - ptz = onvif.create_ptz_service() + if profile is None: + logger.error( + f"No appropriate Onvif profiles found for camera: {camera_name}." + ) + return False - # get the PTZ config for the first onvif profile + # get the PTZ config for the profile try: configs = profile.PTZConfiguration logger.debug(