Normal Frigate Event API
This commit is contained in:
@ -130,7 +130,7 @@ def handle_event(event_id):
|
|||||||
logger.debug(f"Skipping already emailed event: {event_id}")
|
logger.debug(f"Skipping already emailed event: {event_id}")
|
||||||
return
|
return
|
||||||
|
|
||||||
clip_url = f"{HOMEASSISTANT_URL}/api/frigate/notifications/{event_id}/{event_info['camera']}/clip.mp4"
|
clip_url = f"{HOMEASSISTANT_URL}/api/events/{event_id}/snapshot.jpg"
|
||||||
message = f"A {event_info['event_label']} was detected on camera: {event_info['camera']}.\nEvent ID: {event_id}"
|
message = f"A {event_info['event_label']} was detected on camera: {event_info['camera']}.\nEvent ID: {event_id}"
|
||||||
|
|
||||||
send_email(message, event_info['snapshot_urls'], event_info['event_label'], clip_url)
|
send_email(message, event_info['snapshot_urls'], event_info['event_label'], clip_url)
|
||||||
@ -161,7 +161,7 @@ def on_message(client, userdata, message):
|
|||||||
logger.info(f"Event from camera '{camera}' with label '{event_label}' and zones '{zones}' blocked by alert rules.")
|
logger.info(f"Event from camera '{camera}' with label '{event_label}' and zones '{zones}' blocked by alert rules.")
|
||||||
return
|
return
|
||||||
|
|
||||||
snapshot_url = f"{HOMEASSISTANT_IP}/api/frigate/notifications/{event_id}/snapshot.jpg"
|
snapshot_url = f"{HOMEASSISTANT_IP}/api/events/{event_id}/snapshot.jpg"
|
||||||
|
|
||||||
if event_id not in event_cache:
|
if event_id not in event_cache:
|
||||||
# First time seeing this event
|
# First time seeing this event
|
||||||
|
4
log.py
4
log.py
@ -126,7 +126,7 @@ def handle_event(event_id):
|
|||||||
logging.warning(f"No cached info found for event ID: {event_id} on handle_event")
|
logging.warning(f"No cached info found for event ID: {event_id} on handle_event")
|
||||||
return
|
return
|
||||||
|
|
||||||
clip_url = f"{HOMEASSISTANT_URL}/api/frigate/notifications/{event_id}/{event_info['camera']}/clip.mp4"
|
clip_url = f"{HOMEASSISTANT_URL}/api/events/{event_id}/snapshot.jpg"
|
||||||
email_message = f"A {event_info['event_label']} was detected on camera {event_info['camera']}.\nEvent ID: {event_id}"
|
email_message = f"A {event_info['event_label']} was detected on camera {event_info['camera']}.\nEvent ID: {event_id}"
|
||||||
|
|
||||||
send_email(email_message, event_info['snapshot_urls'], event_info['event_label'], clip_url)
|
send_email(email_message, event_info['snapshot_urls'], event_info['event_label'], clip_url)
|
||||||
@ -162,7 +162,7 @@ def on_message(client, userdata, message):
|
|||||||
logging.info(f"Event from camera '{camera}' with label '{event_label}' and zones '{zones}' blocked by alert rules.")
|
logging.info(f"Event from camera '{camera}' with label '{event_label}' and zones '{zones}' blocked by alert rules.")
|
||||||
return
|
return
|
||||||
|
|
||||||
snapshot_url = f"{HOMEASSISTANT_IP}/api/frigate/notifications/{event_id}/snapshot.jpg"
|
snapshot_url = f"{HOMEASSISTANT_IP}/api/events/{event_id}/snapshot.jpg"
|
||||||
|
|
||||||
if event_id in event_cache:
|
if event_id in event_cache:
|
||||||
event_cache[event_id]['snapshot_urls'].append(snapshot_url)
|
event_cache[event_id]['snapshot_urls'].append(snapshot_url)
|
||||||
|
4
main.py
4
main.py
@ -130,7 +130,7 @@ def handle_event(event_id):
|
|||||||
logger.debug(f"Skipping already emailed event: {event_id}")
|
logger.debug(f"Skipping already emailed event: {event_id}")
|
||||||
return
|
return
|
||||||
|
|
||||||
clip_url = f"{HOMEASSISTANT_URL}/api/frigate/notifications/{event_id}/{event_info['camera']}/clip.mp4"
|
clip_url = f"{HOMEASSISTANT_URL}/api/events/{event_id}/snapshot.jpg"
|
||||||
message = f"A {event_info['event_label']} was detected on camera: {event_info['camera']}.\nEvent ID: {event_id}"
|
message = f"A {event_info['event_label']} was detected on camera: {event_info['camera']}.\nEvent ID: {event_id}"
|
||||||
|
|
||||||
send_email(message, event_info['snapshot_urls'], event_info['event_label'], clip_url)
|
send_email(message, event_info['snapshot_urls'], event_info['event_label'], clip_url)
|
||||||
@ -161,7 +161,7 @@ def on_message(client, userdata, message):
|
|||||||
logger.info(f"Event from camera '{camera}' with label '{event_label}' and zones '{zones}' blocked by alert rules.")
|
logger.info(f"Event from camera '{camera}' with label '{event_label}' and zones '{zones}' blocked by alert rules.")
|
||||||
return
|
return
|
||||||
|
|
||||||
snapshot_url = f"{HOMEASSISTANT_IP}/api/frigate/notifications/{event_id}/snapshot.jpg"
|
snapshot_url = f"{HOMEASSISTANT_IP}/api/events/{event_id}/snapshot.jpg"
|
||||||
|
|
||||||
if event_id not in event_cache:
|
if event_id not in event_cache:
|
||||||
# First time seeing this event
|
# First time seeing this event
|
||||||
|
Reference in New Issue
Block a user