From bdd88433516513bd0fec9970c73511a0f20fe712 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sat, 2 Dec 2023 12:14:34 -0600 Subject: [PATCH] handle onvif connection failure in autotrack init --- frigate/ptz/autotrack.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frigate/ptz/autotrack.py b/frigate/ptz/autotrack.py index b5aee57dc..e8edff5d7 100644 --- a/frigate/ptz/autotrack.py +++ b/frigate/ptz/autotrack.py @@ -238,6 +238,16 @@ class PtzAutoTracker: self.move_queues[camera] = queue.Queue() self.move_queue_locks[camera] = threading.Lock() + # handle onvif constructor failing due to no connection + if camera not in self.onvif.cams: + logger.warning( + f"onvif connection to {camera} failed. Disabling autotracking." + ) + camera_config.onvif.autotracking.enabled = False + self.ptz_metrics[camera]["ptz_autotracker_enabled"].value = False + + return + if not self.onvif.cams[camera]["init"]: if not self.onvif._init_onvif(camera): logger.warning(f"Unable to initialize onvif for {camera}")