send MQTT snapshot when object enters required zone (#22690)

When mqtt.required_zones is configured, the initial mqtt snapshot on
object creation is always blocked because zone evaluation hasn't run
yet (entered_zones is empty). Later, the snapshot is only re-sent if
a better thumbnail is found, so if the first frame was already the
best capture the snapshot is silently lost.

Add a new_zone_entered flag to TrackedObject that triggers an mqtt
snapshot publish as soon as zone entry is confirmed, closing the gap
between object detection and zone evaluation.

Closes blakeblackshear/frigate#21027
This commit is contained in:
Josh Hawkins
2026-03-29 12:33:57 -05:00
committed by GitHub
parent b04b1d0dc8
commit f002513d36
2 changed files with 14 additions and 0 deletions
+2
View File
@@ -61,6 +61,7 @@ class TrackedObject:
self.zone_loitering: dict[str, int] = {}
self.current_zones: list[str] = []
self.entered_zones: list[str] = []
self.new_zone_entered: bool = False
self.attributes: dict[str, float] = defaultdict(float)
self.false_positive = True
self.has_clip = False
@@ -278,6 +279,7 @@ class TrackedObject:
if name not in self.entered_zones:
self.entered_zones.append(name)
self.new_zone_entered = True
else:
self.zone_loitering[name] = loitering_score