Frigate video via Telegram

Ok, thanks a lot. So this works for the pics but not the video?

It’s for both

Ok since for me had always hard time using notify, I use other service
telegram_bot.send_photo
telegram_bot.send_video

but is not working, anyone knwos what is wrong?


  - alias: Notify of events
    trigger:
      platform: mqtt
      topic: frigate/events
    condition: '{{ trigger.payload_json["type"] == "end" }}'
    action:
    - service: telegram_bot.send_photo
      data_template:
        message: A {{trigger.payload_json["after"]["label"]}} was detected.
        data:
          photo:
          - url: http://ccab4aaf-frigate:5000/api/events/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg
            caption: A {{trigger.payload_json["after"]["label"]}} was detected on {{
              trigger.payload_json["after"]["camera"] }} camera
        target: '-29091xxxx'
    - delay:
        hours: 0
        minutes: 0
        seconds: 45
        milliseconds: 0
    - service: telegram_bot.send_video
      data_template:
        message: Video of alert
        data:
          video:
          - url: https://xxxx/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/{{trigger.payload_json["after"]["camera"]}}/clip.mp4
            timeout: 1000
            caption: A {{trigger.payload_json["after"]["label"]}} was detected on {{
              trigger.payload_json["after"]["camera"] }} camera
          target: '-29091xxxxx'
    mode: single

tried also this but not working. Any hint?


  - alias: Notify of events
    trigger:
      platform: mqtt
      topic: frigate/events
    condition: '{{ trigger.payload_json["type"] == "end" }}'
    action:
    - service: telegram_bot.send_photo
      data_template:
        url: http://ccab4aaf-frigate:5000/api/events/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg
        caption: A {{trigger.payload_json["after"]["label"]}} was detected on {{
              trigger.payload_json["after"]["camera"] }} camera
        target: '-29091xxxx'
    - delay:
        hours: 0
        minutes: 0
        seconds: 45
        milliseconds: 0
    - service: telegram_bot.send_video
      data_template:
        url: https://xxxxx/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/{{trigger.payload_json["after"]["camera"]}}/clip.mp4
        timeout: 1000
        caption: A {{trigger.payload_json["after"]["label"]}} was detected on {{
              trigger.payload_json["after"]["camera"] }} camera
        target: '-29091xxx'
    mode: single

I get it work after adding api section into the configuration.yaml.

Hi I have API: enabled, can you please help to check why my code is not working?

For video, try http not https by the following url?

url: ‘http://HA_URL:8123/api/frigate/notifications/{{trigger.payload_json[“after”][“id”]}}/{{trigger.payload_json[“after”][“camera”]}}/clip.mp4’

Tried using http://ccab4aaf-frigate:5000 initially based on Frigate doco, but did not work somehow.

Thanks i am out of town and can’t change configuration (VPN not working) will try when I get back tomorrow

YOu mean as below?

url: http://192.168.1.12:5000/api/events/{{trigger.payload_…
url: http://192.168.1.12:8123/api/frigate/notifications/{{trig …

Yes I have been using the second url and works perfectly so far.

Hi, it works for me, both

Other small issue but imporetant. I tend to have lots of events, and since I want to keep 7 days of clips and I need more space.

I do have HASS under proxmox, on an Intel NUC. SO I bought an external SSD with USB 3. I can easily make proxmox accept it … but how to store the clips on the new hard drive?, I do need to make a folder and then tell Frigate to write media files to THAT folder …

any hint?

Hi,

can you please help me get frigate telegram notification to work with picture and video?

Sadly i dont get the pieces of code which where shared here not to work.

I did manage to install frigate to my HA.
Im using frigate proxy means i have an external frigate instance running.
Currently i have 2 CAMs active.
Integration is running fine.
I was able to create an automation which sends me a telegram message when a person on Camera 1 is detected which is great. So basic setup inlcuding telegram notification is running.

But i really like to have an automation per Camera where i get the picture in telegram notification and if possible the video.
I only need URL to attach it to telegram per camera/deteciton type.

So i can turn it on and beeing alarmed when i im on leave when someone is at front/backdoor.
My current Automation yaml looks like that:

'alias: Person in Frontdoor
description: ‘’
trigger:

  • type: motion
    platform: device
    device_id: 68cce7cf5cf62f9fe3cd9c866335129c
    entity_id: binary_sensor.eingang_person_motion
    domain: binary_sensor
    condition: []
    action:
  • service: notify.frigate_ma_bot
    data:
    message: Detected a person on Frontdoor.
    mode: single’

Did you have a look at this?

automation:
  - alias: Notify of events
    trigger:
      platform: mqtt
      topic: frigate/events
    action:
      - service: notify.mobile_app_pixel_3
        data_template:
          message: 'A {{trigger.payload_json["after"]["label"]}} was detected.'
          data:
            image: 'https://your.public.hass.address.com/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android'
            tag: '{{trigger.payload_json["after"]["id"]}}'
            when: '{{trigger.payload_json["after"]["start_time"]|int}}'

I’m trying this but keep getting:

Error rendering data template: UndefinedError: 'dict object' has no attribute 'payload_json'