From f5b1f96164d79d349b7c17f19c625646abf8fe46 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Tue, 26 Apr 2022 18:47:07 -0600 Subject: [PATCH] Use object processing instead of passing mqtt client around --- frigate/object_processing.py | 6 ++++++ frigate/video.py | 9 --------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/frigate/object_processing.py b/frigate/object_processing.py index a7509ef49..a0c959cde 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -879,6 +879,12 @@ class TrackedObjectProcessor(threading.Thread): frame_time, current_tracked_objects, motion_boxes, regions ) + self.client.publish( + f"{self.topic_prefix}/{camera}/motion/detected", + True if motion_boxes else False, + retain=False + ) + tracked_objects = [ o.to_dict() for o in camera_state.tracked_objects.values() ] diff --git a/frigate/video.py b/frigate/video.py index 872b29082..c7fc62ad5 100755 --- a/frigate/video.py +++ b/frigate/video.py @@ -340,8 +340,6 @@ def capture_camera(name, config: CameraConfig, process_info): def track_camera( name, config: CameraConfig, - mqtt_client, - mqtt_prefix, model_shape, labelmap, detection_queue, @@ -383,8 +381,6 @@ def track_camera( process_frames( name, - mqtt_client, - mqtt_prefix, frame_queue, frame_shape, model_shape, @@ -472,8 +468,6 @@ def detect( def process_frames( camera_name: str, - mqtt_client, - mqtt_prefix, frame_queue: mp.Queue, frame_shape, model_shape, @@ -524,9 +518,6 @@ def process_frames( # look for motion if enabled motion_boxes = motion_detector.detect(frame) if motion_enabled.value else [] - if mqtt_client: - mqtt_client(f"{mqtt_prefix}/{camera_name}/motion/detected", True if motion_boxes else False, False) - regions = [] # if detection is disabled