Skip to content

NVR with realtime local object detection for IP cameras

Fix audio events not being ended (#6981)

Nicolas Mowenc25367221e67
diff --git a/frigate/events/audio.py b/frigate/events/audio.py
index e1d25e0188..164c9c62d1 100644
--- a/frigate/events/audio.py
+++ b/frigate/events/audio.py
@@ -202,11 +202,13 @@ class AudioEventMaintainer(threading.Thread):
now = datetime.datetime.now().timestamp()
for detection in self.detections.values():
+ if not detection:
+ continue
+
if (
now - detection.get("last_detection", now)
> self.config.audio.max_not_heard
):
- del self.detections[detection["label"]]
requests.put(
f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end",
json={
@@ -214,6 +216,7 @@ class AudioEventMaintainer(threading.Thread):
+ self.config.record.events.post_capture
},
)
+ self.detections[detection["label"]] = None
def restart_audio_pipe(self) -> None:
try:
diff --git a/frigate/events/maintainer.py b/frigate/events/maintainer.py
index f024f0be6b..d688f7dfeb 100644
--- a/frigate/events/maintainer.py
+++ b/frigate/events/maintainer.py
@@ -239,6 +239,6 @@ class EventProcessor(threading.Thread):
}
try:
- Event.update(event).execute()
+ Event.update(event).where(Event.id == event_data["id"]).execute()
except Exception:
logger.warning(f"Failed to update manual event: {event_data['id']}")