Fixed datetime bug
This commit is contained in:
1 parent
4ec4531f86
commit
fc63499bf0
2 files changed
+12
-13
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import os
|
||||
import json
|
||||
from time import sleep
|
||||
from datetime import datetime, timedelta
|
||||
import datetime as dt
|
||||
|
||||
import requests
|
||||
import paho.mqtt.client as mqtt
|
||||
@@ -24,8 +23,8 @@ class FrigateEventNotifier:
|
||||
self.last_notification_time = {}
|
||||
|
||||
def send_notification(self, event_id, camera, object_label, score, priority=3):
|
||||
now = datetime.now()
|
||||
if now - self.last_notification_time.get(camera, datetime.min) >= timedelta(seconds=self.quiet_period):
|
||||
now = dt.datetime.now()
|
||||
if now - self.last_notification_time.get(camera, dt.datetime.min) >= dt.timedelta(seconds=self.quiet_period):
|
||||
# Quiet period has passed since the last notification for this camera
|
||||
self.last_notification_time[camera] = now
|
||||
camera_location = ' '.join(word.capitalize() for word in camera.split('_'))
|
||||
|
||||
Reference in new issue
Block a user