Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. burin revised this gist Jan 5, 2025. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -63,7 +63,7 @@ blueprint:
    default: ""
    selector:
    entity: {}
    source_url: https://gist.github.com/dimitrystd/76770fee73496f928c7967be3842eb44
    source_url: https://gist.github.com/burin/5761309c43ba3e0b26fc5fe0e9729e0e
    mode: single
    max_exceeded: silent
    trigger:
    @@ -101,7 +101,7 @@ action:
    target: !input target_chat
    disable_notification: !input notification_photo
    caption: "{{message_caption}} {{ camera_name }}"
    url: "{{base_url}}/api/events/{{id}}/snapshot.jpg"
    url: "{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg"
    message_tag: !input message_tag
    - repeat:
    sequence:
    @@ -123,7 +123,7 @@ action:
    target: !input target_chat
    disable_notification: !input notification_video
    caption: "{{message_caption}} {{ camera_name }}"
    url: "{{base_url}}/api/events/{{id}}/clip.mp4"
    url: "{{base_url}}/api/frigate/notifications/{{id}}/clip.mp4"
    timeout: 20
    message_tag: !input message_tag
    until: "{{ wait.trigger.payload_json['type'] == 'end' }}"
  2. burin revised this gist Jan 5, 2025. No changes.
  3. @dimitrystd dimitrystd revised this gist Jul 19, 2022. 1 changed file with 84 additions and 69 deletions.
    153 changes: 84 additions & 69 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -5,34 +5,46 @@ blueprint:
    input:
    camera:
    name: Frigate Camera
    description: The name of the camera as defined in your frigate configuration
    (/conf.yml).
    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. '
    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_photo:
    name: Disable photo notification
    description: "True/false for send the message with photo silently"
    default: false
    selector:
    boolean:
    notification_video:
    name: Disable video notification
    description: "True/false for send the message with video silently"
    default: false
    selector:
    select:
    options:
    - 'true'
    - 'false'
    default: 'false'
    boolean:
    message_caption:
    name: (Optional) The title of the photo\video
    description: User-friendly text
    default: "Motion detected:"
    message_tag:
    name: (Optional) Tag for sent message
    description: Can be usuful for your automation
    default: ""
    base_url:
    name: (Optional) Base URL
    description: The external url for your Home Assistant instance. This will default
    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: ''
    default: ""
    zone_filter:
    name: (Optional) Zone Filter
    description: Only notify if object has entered a defined zone.
    default: false
    selector:
    boolean: {}
    boolean:
    zones:
    name: (Optional) Trigger Zones
    description: A list (-) of zones you wish to recieve notifications for.
    @@ -48,7 +60,7 @@ blueprint:
    presence_filter:
    name: (Optional) Presence Filter
    description: Only notify if selected presence entity is not "home".
    default: ''
    default: ""
    selector:
    entity: {}
    source_url: https://gist.github.com/dimitrystd/76770fee73496f928c7967be3842eb44
    @@ -57,58 +69,61 @@ max_exceeded: silent
    trigger:
    platform: mqtt
    topic: frigate/events
    payload: !input 'camera'
    value_template: '{{ value_json[''after''][''camera''] }}'
    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'
    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
    message_caption: !input message_caption
    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'') }}'
    - "{{ 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: 'Motion detected: {{ camera_name }}'
    url: '{{base_url}}/api/events/{{id}}/snapshot.jpg'
    - repeat:
    sequence:
    - wait_for_trigger:
    - platform: mqtt
    topic: frigate/events
    payload: '{{ id }}'
    value_template: '{{ value_json[''after''][''id''] }}'
    timeout:
    minutes: 2
    continue_on_timeout: false
    - condition: template
    value_template: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
    - alias: Extra delay before getting video file
    delay: 5
    - service: telegram_bot.send_video
    alias: Send video
    data:
    target: '{{ target_chat }}'
    disable_notification: '{{ notification }}'
    caption: 'Motion detected: {{ camera_name }}'
    url: '{{base_url}}/api/events/{{id}}/clip.mp4'
    timeout: 20
    until: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
    - service: telegram_bot.send_photo
    alias: Send photo
    data:
    target: !input target_chat
    disable_notification: !input notification_photo
    caption: "{{message_caption}} {{ camera_name }}"
    url: "{{base_url}}/api/events/{{id}}/snapshot.jpg"
    message_tag: !input message_tag
    - repeat:
    sequence:
    - wait_for_trigger:
    - platform: mqtt
    topic: frigate/events
    payload: "{{ id }}"
    value_template: "{{ value_json['after']['id'] }}"
    timeout:
    minutes: 2
    continue_on_timeout: false
    - condition: template
    value_template: "{{ wait.trigger.payload_json['type'] == 'end' }}"
    - alias: Extra delay before getting video file
    delay: 5
    - service: telegram_bot.send_video
    alias: Send video
    data:
    target: !input target_chat
    disable_notification: !input notification_video
    caption: "{{message_caption}} {{ camera_name }}"
    url: "{{base_url}}/api/events/{{id}}/clip.mp4"
    timeout: 20
    message_tag: !input message_tag
    until: "{{ wait.trigger.payload_json['type'] == 'end' }}"
  4. @dimitrystd dimitrystd revised this gist Jul 16, 2022. 1 changed file with 15 additions and 14 deletions.
    29 changes: 15 additions & 14 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -5,23 +5,21 @@ blueprint:
    input:
    camera:
    name: Frigate Camera
    description: The name of the camera as defined in your frigate configuration (/conf.yml).
    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.
    '
    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.
    '
    notification. '
    selector:
    select:
    options:
    - 'true'
    - 'false'
    - 'true'
    - 'false'
    default: 'false'
    base_url:
    name: (Optional) Base URL
    @@ -53,7 +51,7 @@ blueprint:
    default: ''
    selector:
    entity: {}
    source_url: https://gist.github.com/NdR91/5486a1e55101e062c48545395b7dd9a3
    source_url: https://gist.github.com/dimitrystd/76770fee73496f928c7967be3842eb44
    mode: single
    max_exceeded: silent
    trigger:
    @@ -89,8 +87,7 @@ action:
    data:
    target: '{{ target_chat }}'
    disable_notification: '{{ notification }}'
    caption: |
    Movimento rilevato. Telecamera: {{ camera_name }} (ID: {{ id }})
    caption: 'Motion detected: {{ camera_name }}'
    url: '{{base_url}}/api/events/{{id}}/snapshot.jpg'
    - repeat:
    sequence:
    @@ -104,10 +101,14 @@ action:
    continue_on_timeout: false
    - condition: template
    value_template: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
    - alias: Extra delay before getting video file
    delay: 5
    - service: telegram_bot.send_video
    alias: Send video
    data:
    target: '{{ target_chat }}'
    disable_notification: '{{ notification }}'
    caption: 'Movimento rilevato. Telecamera: {{ camera_name }}'
    caption: 'Motion detected: {{ camera_name }}'
    url: '{{base_url}}/api/events/{{id}}/clip.mp4'
    until: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
    timeout: 20
    until: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
  5. @dimitrystd dimitrystd revised this gist Jul 16, 2022. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -91,8 +91,7 @@ action:
    disable_notification: '{{ notification }}'
    caption: |
    Movimento rilevato. Telecamera: {{ camera_name }} (ID: {{ id }})
    url: >-
    {{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg
    url: '{{base_url}}/api/events/{{id}}/snapshot.jpg'
    - repeat:
    sequence:
    - wait_for_trigger:
    @@ -110,6 +109,5 @@ action:
    target: '{{ target_chat }}'
    disable_notification: '{{ notification }}'
    caption: 'Movimento rilevato. Telecamera: {{ camera_name }}'
    url: >-
    {{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
    url: '{{base_url}}/api/events/{{id}}/clip.mp4'
    until: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
  6. @NdR91 NdR91 revised this gist Nov 12, 2021. 1 changed file with 23 additions and 18 deletions.
    41 changes: 23 additions & 18 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -1,28 +1,33 @@
    blueprint:
    name: Frigate - Telegram Notification
    description: 'Create automations to receive Snapshots and Clips from Frigate'
    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.
    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. You can put also the '!secret chat_id'
    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.
    description: 'Select "true" to disable notification, lave "false" to receive
    notification.
    '
    selector:
    select:
    options:
    - 'true'
    - 'false'
    - 'true'
    - 'false'
    default: 'false'
    base_url:
    name: (Optional) Base URL
    description: 'The external url for your Home Assistant instance. This will default
    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.'
    which may cause issues on some devices.
    default: ''
    zone_filter:
    name: (Optional) Zone Filter
    @@ -48,7 +53,7 @@ blueprint:
    default: ''
    selector:
    entity: {}

    source_url: https://gist.github.com/NdR91/5486a1e55101e062c48545395b7dd9a3
    mode: single
    max_exceeded: silent
    trigger:
    @@ -80,14 +85,14 @@ condition:
    - '{{ 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: !input 'target_chat'
    disable_notification: !input 'notification'
    caption: 'Movimento rilevato. Telecamera: {{ camera_name }}'
    target: '{{ target_chat }}'
    disable_notification: '{{ notification }}'
    caption: |
    Movimento rilevato. Telecamera: {{ camera_name }} (ID: {{ id }})
    url: >-
    url: /api/frigate/notifications/{{id}}/snapshot.jpg
    {{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg
    - repeat:
    sequence:
    - wait_for_trigger:
    @@ -100,11 +105,11 @@ action:
    continue_on_timeout: false
    - condition: template
    value_template: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'

    - service: telegram_bot.send_video
    data:
    target: !input 'target_chat'
    disable_notification: !input 'notification'
    target: '{{ target_chat }}'
    disable_notification: '{{ notification }}'
    caption: 'Movimento rilevato. Telecamera: {{ camera_name }}'
    url: >-
    '{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4'
    {{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
    until: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
  7. @NdR91 NdR91 revised this gist Nov 11, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -60,6 +60,7 @@ 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''] }}'
    @@ -71,6 +72,7 @@ variables:
    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 }}'
  8. @NdR91 NdR91 revised this gist Nov 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    blueprint:
    name: Frigate - Telegram Notification
    description: []
    description: 'Create automations to receive Snapshots and Clips from Frigate'
    domain: automation
    input:
    camera:
  9. @NdR91 NdR91 revised this gist Nov 11, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,9 @@ blueprint:
    selector:
    select:
    options:
    - true
    - false
    default: false
    - 'true'
    - 'false'
    default: 'false'
    base_url:
    name: (Optional) Base URL
    description: 'The external url for your Home Assistant instance. This will default
  10. @NdR91 NdR91 revised this gist Nov 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ blueprint:
    options:
    - true
    - false
    default: 'false'
    default: false
    base_url:
    name: (Optional) Base URL
    description: 'The external url for your Home Assistant instance. This will default
  11. @NdR91 NdR91 revised this gist Nov 11, 2021. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,11 @@ blueprint:
    notification:
    name: Notification
    description: Select "true" to disable notification, lave "false" to receive notification.
    select:
    options:
    - true
    - false
    selector:
    select:
    options:
    - true
    - false
    default: 'false'
    base_url:
    name: (Optional) Base URL
  12. @NdR91 NdR91 revised this gist Nov 11, 2021. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -12,11 +12,10 @@ blueprint:
    notification:
    name: Notification
    description: Select "true" to disable notification, lave "false" to receive notification.
    selector:
    select:
    options:
    - true
    - false
    select:
    options:
    - true
    - false
    default: 'false'
    base_url:
    name: (Optional) Base URL
  13. @NdR91 NdR91 revised this gist Nov 11, 2021. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -13,9 +13,10 @@ blueprint:
    name: Notification
    description: Select "true" to disable notification, lave "false" to receive notification.
    selector:
    options:
    - true
    - false
    select:
    options:
    - true
    - false
    default: 'false'
    base_url:
    name: (Optional) Base URL
  14. @NdR91 NdR91 created this gist Nov 11, 2021.
    107 changes: 107 additions & 0 deletions frigate_telegram_notification.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,107 @@
    blueprint:
    name: Frigate - Telegram Notification
    description: []
    domain: automation
    input:
    camera:
    name: Frigate Camera
    description: The name of the camera as defined in your frigate configuration.
    target_chat:
    name: Target
    description: The chat_id to be used by the Telegram bot. You can put also the '!secret chat_id'
    notification:
    name: Notification
    description: Select "true" to disable notification, lave "false" to receive notification.
    selector:
    options:
    - true
    - 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: {}

    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 }}'
    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'
    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: !input 'target_chat'
    disable_notification: !input 'notification'
    caption: 'Movimento rilevato. Telecamera: {{ camera_name }}'
    url: >-
    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: 2
    continue_on_timeout: false
    - condition: template
    value_template: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'

    - service: telegram_bot.send_video
    data:
    target: !input 'target_chat'
    disable_notification: !input 'notification'
    caption: 'Movimento rilevato. Telecamera: {{ camera_name }}'
    url: >-
    '{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4'