From 2b288adf38ee3ec6cab998811bf45cf98bcecfe8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 22:46:39 +0000 Subject: [PATCH 1/3] Initial plan From bb534d81f5c96a3adcfaac1cf1f3a02aa9ade29e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 22:52:19 +0000 Subject: [PATCH 2/3] Fix MQTT count topics to deduplicate by object_id Co-authored-by: Teagan42 <2989925+Teagan42@users.noreply.github.com> --- frigate/camera/activity_manager.py | 35 ++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/frigate/camera/activity_manager.py b/frigate/camera/activity_manager.py index c2dfa891d..ae5694540 100644 --- a/frigate/camera/activity_manager.py +++ b/frigate/camera/activity_manager.py @@ -69,15 +69,28 @@ class CameraActivityManager: # run through every zone, getting a count of objects in that zone right now for zone, labels in self.all_zone_labels.items(): - all_zone_objects = Counter( - obj["label"].replace("-verified", "") + # Deduplicate objects by object_id before counting + # This ensures each unique object is only counted once even if it appears + # multiple times (e.g., with custom classifications) + zone_objects_by_id = { + obj["id"]: obj for obj in all_objects if zone in obj["current_zones"] - ) - active_zone_objects = Counter( + } + all_zone_objects = Counter( obj["label"].replace("-verified", "") + for obj in zone_objects_by_id.values() + ) + + # Same deduplication for active objects + active_zone_objects_by_id = { + obj["id"]: obj for obj in all_objects if zone in obj["current_zones"] and not obj["stationary"] + } + active_zone_objects = Counter( + obj["label"].replace("-verified", "") + for obj in active_zone_objects_by_id.values() ) any_changed = False @@ -113,13 +126,21 @@ class CameraActivityManager: def compare_camera_activity( self, camera: str, new_activity: dict[str, Any] ) -> None: + # Deduplicate objects by object_id before counting + # This ensures each unique object is only counted once even if it appears + # multiple times (e.g., with custom classifications) + objects_by_id = {obj["id"]: obj for obj in new_activity} all_objects = Counter( - obj["label"].replace("-verified", "") for obj in new_activity + obj["label"].replace("-verified", "") for obj in objects_by_id.values() ) + + # Same deduplication for active objects + active_objects_by_id = { + obj["id"]: obj for obj in new_activity if not obj["stationary"] + } active_objects = Counter( obj["label"].replace("-verified", "") - for obj in new_activity - if not obj["stationary"] + for obj in active_objects_by_id.values() ) any_changed = False From 2344eea392768b7c615dc860e90ec250aa2eeb8a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 22:59:08 +0000 Subject: [PATCH 3/3] Fix ruff formatting issues in activity_manager.py Co-authored-by: Teagan42 <2989925+Teagan42@users.noreply.github.com> --- frigate/camera/activity_manager.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frigate/camera/activity_manager.py b/frigate/camera/activity_manager.py index ae5694540..ec0c8546d 100644 --- a/frigate/camera/activity_manager.py +++ b/frigate/camera/activity_manager.py @@ -73,15 +73,13 @@ class CameraActivityManager: # This ensures each unique object is only counted once even if it appears # multiple times (e.g., with custom classifications) zone_objects_by_id = { - obj["id"]: obj - for obj in all_objects - if zone in obj["current_zones"] + obj["id"]: obj for obj in all_objects if zone in obj["current_zones"] } all_zone_objects = Counter( obj["label"].replace("-verified", "") for obj in zone_objects_by_id.values() ) - + # Same deduplication for active objects active_zone_objects_by_id = { obj["id"]: obj @@ -133,7 +131,7 @@ class CameraActivityManager: all_objects = Counter( obj["label"].replace("-verified", "") for obj in objects_by_id.values() ) - + # Same deduplication for active objects active_objects_by_id = { obj["id"]: obj for obj in new_activity if not obj["stationary"]