hello guys,
after having read a lot posts and tried many configurations, here I’am to ask for a help.
SETUP:
Home Assitstant Version
- core-2021.11.3
- supervisor-2021.12.2
- Home Assistant OS 6.6
FrigateProxy Version 1.3
Frigate external Docker image: 0.9.4
SCOPE:
Send email notifications with snapshots attachment triggered from frigate object detection
CONFIGURATION
as for now everything seem to be running, except that I don’t see the image/s attached to the email that are sent correctly.
The automation is configured with a MQTT trigger on frigate/events topic to retrieve the event ID triggered from the frigate object detection system.
here is the code:
- id: '1640686723123'
alias: AUTOMATION-MOTION-DETECTION-EMAIL
description: ' '
trigger:
- platform: mqtt
topic: frigate/events
payload: "CAM1 #!input 'camera'
value_template: '{{ value_json[''after''][''camera''] }}'
variables:
frigateid: '{{ trigger.payload_json[''after''][''id''] }}'
camera: '{{ trigger.payload_json[''after''][''camera''] }}'
camera_name: '{{ camera | replace(''_'', '' '') | title }}'
object: '{{ trigger.payload_json[''after''][''label''] }}'
label: '{{ object | title }}'
entered_zones: '{{ trigger.payload_json[''after''][''entered_zones''] }}'
type: '{{ trigger.payload_json[''type''] }}'
condition: []
action:
- service: notify.NOTIFICATION_EMAIL
data:
title: ALERT!
message: Alert motion detection
data:
html: >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Intruder alert</title>
</head>
<body>
<div>
<div>
<h1>Intruder alert at Camera: <b>{{ camera_name }}</b></h1>
</div>
</div>
<div>
<div>
<div>
<img src="http://<frigateIP>:5000/api/events/{{frigateid}}/snapshot.jpg" />
</div>
<div>
<h2 ENd message />
</div>
</div>
<br>
</div>
</body>
</html>
mode: single
I want to add that I configured another notify service that uses the SMTP component and it is configured with a local mail server (and relay) written in JS… and, guess…, the email contains the image attached that I can check from the web GUI; when it relays externally the email, the attachment is not present anymore; believe me, I do not understand when using a public SMTP server the image is not attached, in both cases, or using SMTP Public server or relaying the email through a SMTP Public server.
looking at the Home Assistant SMTP component python code it seems that component needs the image/s to be retrieved from the FS (as described in this topic) other than the HTML code.
Is there a way to load the image form an URL? or a way to attach to the email an image triggered from frigate (external server)?
I do the same with the Telegram Notification and I’m able to receive the notification with the snapshot attached.
any help and/or suggestions will be appreciated and thank you in advance.