Skip to content

Instantly share code, notes, and snippets.

@girs1982
Last active June 23, 2024 20:58
Show Gist options
  • Save girs1982/9dc07ca50f0c0882f2f4d3e33231be29 to your computer and use it in GitHub Desktop.
Save girs1982/9dc07ca50f0c0882f2f4d3e33231be29 to your computer and use it in GitHub Desktop.
blueprint:
name: Frigate - Telegram Notification mqtt By Gansta
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."
notification:
name: Notification
description: 'Select "true" to disable notification, leave "false" to receive notification.'
selector:
select:
options:
- "true"
- "false"
default: "false"
base_url:
name: (Optional) Base URL
description: The external URL for your Home Assistant instance.
default: ""
source_url: https://gist.github.com/NdR91/5486a1e55101e062c48545395b7dd9a3
mode: single
max_exceeded: silent
trigger:
platform: mqtt
topic: /knop/frigate/{{ camera }}/person/snapshot
variables:
id: "{{ trigger.id }}"
camera_name: "{{ camera | replace('_', ' ') | title }}"
target_chat: !input target_chat
notification: !input notification
base_url: !input base_url
action:
- service: mqtt.publish
data:
topic: "frigate/notify/{{ id }}/save_snapshot"
payload: "{{ trigger.payload }}"
- wait_for_trigger:
- platform: mqtt
topic: "frigate/notify/{{ id }}/snapshot_saved"
- service: telegram_bot.send_photo
data:
target: "{{ target_chat }}"
disable_notification: "{{ notification }}"
caption: "Person Detected. Camera: {{ camera_name }}"
file: "{{ base_url }}/api/frigate/notifications/{{ id }}/snapshot.jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment