I’m trying to send an event notification from a Unifi Protect camera with a thumbnail. I can get the integration to fire and send the notification, but the thumbnail is never included.
From the system logs I get:
Log details (WARNING)
Logger: homeassistant.components.smtp.notify
Source: components/smtp/notify.py:279
integration: smtp (documentation, issues)
First occurred: 3:34:08 PM (1 occurrences)
Last logged: 3:34:08 PM
Attachment /api/unifiprotect/thumbnail/01JGVDEZBXCEFAQAYNKSBCVTH7/6782d5b90202df03e40014c5 not found. Skipping
My integration is based off the " EXAMPLE NOTIFICATION AUTOMATION WITH VIDEO" from integration page UniFi Protect - Home Assistant
alias: Camera Detection Test
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.ai_pro_frontyard_person_detected
from: "on"
to: "off"
variables:
camera_name: "{{ device_attr(trigger.entity_id, 'name') }}"
nvr_id: "{{ config_entry_id(trigger.entity_id) }}"
event_id: "{{ trigger.from_state.attributes.event_id }}"
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
conditions: []
actions:
- action: notify.family_sms
metadata: {}
data:
title: "{{ trigger.entity_id }}"
message: |
"{{ camera_name }}"
"{{ nvr_id }}"
"{{ event_id }}"
"{{ image_path }}"
data:
images:
- "{{ image_path }}"
mode: single
And I successfully receive the event notification:
The Integration document page has this interesting tidbit - " The easiest way to find the nvr_id
, camera_id
, start
, and end
times is by viewing one of the videos from UniFi Protect in the Media browser. If you open the video in a new browser tab, you will see all these values in the URL."
Here’s the video opened from HA’s Media Browser
(fun fact: you can trigger a “person detection” with two fingers)
As you can see, the nvr_id and event_id are nothing like what the integration code returns and probably why the not found log error is happening.
Has someone successfully used the Protect integration to send the thumbnail of the event? If so, can you see where I’m screwing up?