From f1c30877751f195d85a97ee5bc2ce9f09c4375e4 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Fri, 15 Jan 2021 22:14:15 -0600 Subject: [PATCH] add change type to events topic #476 --- frigate/object_processing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frigate/object_processing.py b/frigate/object_processing.py index 80b2882dd..71c5fb814 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -430,7 +430,7 @@ class TrackedObjectProcessor(threading.Thread): def update(camera, obj: TrackedObject, current_frame_time): after = obj.to_dict() - message = { 'before': obj.previous, 'after': after } + message = { 'before': obj.previous, 'after': after, 'type': 'new' if obj.previous['false_positive'] else 'update' } self.client.publish(f"{self.topic_prefix}/events", json.dumps(message), retain=False) obj.previous = after @@ -439,7 +439,7 @@ class TrackedObjectProcessor(threading.Thread): event_data = obj.to_dict(include_thumbnail=True) event_data['has_snapshot'] = False if not obj.false_positive: - message = { 'before': obj.previous, 'after': obj.to_dict() } + message = { 'before': obj.previous, 'after': obj.to_dict(), 'type': 'end' } self.client.publish(f"{self.topic_prefix}/events", json.dumps(message), retain=False) # write snapshot to disk if enabled if snapshot_config.enabled: