Fix audio events not being ended

This commit is contained in:
Nick Mowen 2023-07-01 15:04:03 -06:00
parent 7ee17c7af8
commit ad3d43f0b1

View File

@ -202,11 +202,14 @@ class AudioEventMaintainer(threading.Thread):
now = datetime.datetime.now().timestamp() now = datetime.datetime.now().timestamp()
for detection in self.detections.values(): for detection in self.detections.values():
if not detection:
continue
if ( if (
now - detection.get("last_detection", now) now - detection.get("last_detection", now)
> self.config.audio.max_not_heard > self.config.audio.max_not_heard
): ):
del self.detections[detection["label"]] self.detections[detection["label"]] = None
requests.put( requests.put(
f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end", f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end",
json={ json={