diff --git a/docs/docs/usage/mqtt.md b/docs/docs/usage/mqtt.md index 83d92bbc2..d91429b16 100644 --- a/docs/docs/usage/mqtt.md +++ b/docs/docs/usage/mqtt.md @@ -32,7 +32,7 @@ Message published for each changed event. The first message is published when th ```json { - "type": "update", // new, update, or end + "type": "update", // new, update, end or clip_ready "before": { "id": "1607123955.475377-mxklsc", "camera": "front_door", diff --git a/frigate/events.py b/frigate/events.py index a9b24dbcf..2325635b5 100644 --- a/frigate/events.py +++ b/frigate/events.py @@ -268,7 +268,7 @@ class EventProcessor(threading.Thread): has_snapshot=event_data["has_snapshot"], ) del self.events_in_process[event_data["id"]] - self.event_processed_queue.put((event_data["id"], camera)) + self.event_processed_queue.put((event_data["id"], camera, clip_created)) logger.info(f"Exiting event processor...") diff --git a/frigate/object_processing.py b/frigate/object_processing.py index 348f049ca..b483940f3 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -767,7 +767,17 @@ class TrackedObjectProcessor(threading.Thread): # cleanup event finished queue while not self.event_processed_queue.empty(): - event_id, camera = self.event_processed_queue.get() + event_id, camera, clip_created = self.event_processed_queue.get() + if clip_created: + obj = self.camera_states[camera].tracked_objects[event_id] + message = { + "before": obj.previous, + "after": obj.to_dict(), + "type": "clip_ready", + } + self.client.publish( + f"{self.topic_prefix}/events", json.dumps(message), retain=False + ) self.camera_states[camera].finished(event_id) logger.info(f"Exiting object processor...")