changed frigate_url to homeassistant_url for easier understanding
This commit is contained in:
6
log.py
6
log.py
@ -31,7 +31,7 @@ SMTP_USERNAME = config["smtp"]["username"]
|
|||||||
SMTP_PASSWORD = config["smtp"]["password"]
|
SMTP_PASSWORD = config["smtp"]["password"]
|
||||||
EMAIL_FROM = config["smtp"]["from"]
|
EMAIL_FROM = config["smtp"]["from"]
|
||||||
EMAIL_TO = config["smtp"]["to"]
|
EMAIL_TO = config["smtp"]["to"]
|
||||||
FRIGATE_URL = config["frigate_url"]
|
HOMEASSISTANT_URL = config["homeassistant_url"]
|
||||||
|
|
||||||
# MQTT configuration
|
# MQTT configuration
|
||||||
MQTT_BROKER_IP = config["mqtt"]["broker_ip"]
|
MQTT_BROKER_IP = config["mqtt"]["broker_ip"]
|
||||||
@ -76,7 +76,7 @@ def send_email(message, snapshot_urls, event_label, clip_url):
|
|||||||
def handle_event(event_id, event_label, snapshot_urls):
|
def handle_event(event_id, event_label, snapshot_urls):
|
||||||
time.sleep(7.5) # Wait for more snapshots before sending email
|
time.sleep(7.5) # Wait for more snapshots before sending email
|
||||||
|
|
||||||
clip_url = f"{FRIGATE_URL}/api/frigate/notifications/{event_id}/gate/clip.mp4"
|
clip_url = f"{HOMEASSISTANT_URL}/api/frigate/notifications/{event_id}/gate/clip.mp4"
|
||||||
email_message = f"A {event_label} was detected.\nEvent ID: {event_id}"
|
email_message = f"A {event_label} was detected.\nEvent ID: {event_id}"
|
||||||
send_email(email_message, snapshot_urls, event_label, clip_url)
|
send_email(email_message, snapshot_urls, event_label, clip_url)
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ def on_message(client, userdata, message):
|
|||||||
|
|
||||||
event_label = event_data["after"]["label"]
|
event_label = event_data["after"]["label"]
|
||||||
event_id = event_data["after"]["id"]
|
event_id = event_data["after"]["id"]
|
||||||
snapshot_url = f"{FRIGATE_URL}/api/frigate/notifications/{event_id}/snapshot.jpg"
|
snapshot_url = f"{HOMEASSISTANT_URL}/api/frigate/notifications/{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)
|
||||||
|
|||||||
Reference in New Issue
Block a user