I have a blueprint that is buggy. It should send me a video of a event recorded with frigate, but it is not working. in fact, somehow the last part where it sends the message with “event end” is also sometimes not working, when i mess around with the blueprint.
However, i already tried a seperate service call of telegram sending me a video, where i use a link thats generated from the above blueprint, wich is being send without problems.
Does anyone have a idea how to fix the blueprint, or how to extract this link in the current blueprint and use it in a seperate automation event to send me the video, because the video send automation is working… So basically a followup automation…But it needs that exact video link from the blueprint to function.
Here is the code of the working simple automation action, again, with a link that comes out of the blueprint:
service: telegram_bot.send_video
data:
url: >-
http://192.168.1.184:8123/api/frigate/notifications/1705350382.011357-l157oq/garage-door/clip.mp4
target: -400000000
timeout: 80
And here is the blueprint that is only working to send me a snapshot and the event link, the two events (send video and send message) afterwards are not working.
The part that’s important is the action at the end of the blueprint. I changed this file for around 50 times already. adding delay, removing delay, adding timeout to the video send as it is needed on the working automation, deleting the timeout…and much more. sometimes, it makes the last send message work again (that includes event end text), but whatever i tried, only the automation with a simple video send service works, and the blueprint does not send me videos anymore.
blueprint:
name: Frigate - Telegram Notification
description: Create automations to receive Snapshots and Clips from Frigate
domain: automation
input:
camera:
name: Frigate Camera
description:
The name of the camera as defined in your frigate configuration
(/conf.yml).
target_chat:
name: Target
description:
"The chat_id to be used by the Telegram bot. !secret chat_id is
not allowed on Blueprint, you will need the chat_id code.
"
notification:
name: Notification
description:
'Select "true" to disable notification, lave "false" to receive
notification. '
selector:
select:
options:
- "true"
- "false"
multiple: false
custom_value: false
sort: false
default: "false"
base_url:
name: (Optional) Base URL
description:
The external url for your Home Assistant instance. This will default
to a relative URL and will open the clips in the app instead of the browser,
which may cause issues on some devices.
default: ""
zone_filter:
name: (Optional) Zone Filter
description: Only notify if object has entered a defined zone.
default: false
selector:
boolean: {}
zones:
name: (Optional) Trigger Zones
description: A list (-) of zones you wish to recieve notifications for.
default: []
selector:
object: {}
labels:
name: (Optional) Trigger Objects
description: A list (-) of objects you wish to recieve notifications for.
default: []
selector:
object: {}
presence_filter:
name: (Optional) Presence Filter
description: Only notify if selected presence entity is not "home".
default: ""
selector:
entity:
multiple: false
source_url: https://gist.github.com/NdR91/5486a1e55101e062c48545395b7dd9a3#file-frigate_telegram_notification-yaml
mode: single
max_exceeded: silent
trigger:
platform: mqtt
topic: frigate/events
payload: !input camera
value_template: "{{ value_json['after']['camera'] }}"
variables:
id: "{{ trigger.payload_json['after']['id'] }}"
camera: "{{ trigger.payload_json['after']['camera'] }}"
camera_name: "{{ camera | replace('_', ' ') | title }}"
target_chat: !input target_chat
object: "{{ trigger.payload_json['after']['label'] }}"
label: "{{ object | title }}"
entered_zones: "{{ trigger.payload_json['after']['entered_zones'] }}"
type: "{{ trigger.payload_json['type'] }}"
base_url: !input base_url
zone_only: !input zone_filter
input_zones: !input zones
zones: "{{ input_zones | list }}"
input_labels: !input labels
labels: "{{ input_labels | list }}"
presence_entity: !input presence_filter
notification: !input notification
condition:
- "{{ type != 'end' }}"
- "{{ not zone_only or entered_zones|length > 0 }}"
- "{{ not zones|length or zones|select('in', entered_zones)|list|length > 0 }}"
- "{{ not labels|length or object in labels }}"
- "{{ not presence_entity or not is_state(presence_entity, 'home') }}"
action:
- service: telegram_bot.send_photo
data:
target: "{{ target_chat }}"
disable_notification: "{{ notification }}"
caption: "{{ camera_name }} Triggered! Watch Live: http://192.168.1.184:1984/stream.html?src={{ camera }} ID={{id}}"
url: "{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg"
- repeat:
sequence:
- wait_for_trigger:
- platform: mqtt
topic: frigate/events
payload: "{{ id }}"
value_template: "{{ value_json['after']['id'] }}"
timeout:
minutes: 3
continue_on_timeout: true
- condition: template
value_template: "{{ wait.trigger.payload_json['type'] == 'end' }}"
- delay: "00:00:06"
- service: telegram_bot.send_message
data:
target: "{{ target_chat }}"
disable_notification: "{{ notification }}"
message: "{{ camera_name }} event link: {{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4"
- delay: "00:00:03"
- service: telegram_bot.send_video
data:
target: "{{ target_chat }}"
disable_notification: true
url: "{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4"
timeout:
minutes: 2
- delay: "00:00:03"
- service: telegram_bot.send_message
data:
target: "{{ target_chat }}"
disable_notification: true
message: " ------------------ Event End ------------------
ID={{id}} "
until: "{{ wait.trigger.payload_json['type'] == 'end' }}"
Been fighting with this for quite a while, would really really appriciate assistance on this.