Telegram notification from Frigate

I am running the following setup:
Proxmox 8.2.4
Home Assistant 2024.7.1 (is running in its own container)
Node-Red v4.0.2, Mosquitto, MariaDB (are running in a separate container)
Frigate 0.13.2 (with Google usb coral TPU) (is also running in it own container)

All is working. But I am receiving a lot of false positives (may alarm messages in Telegram) are not correct.
Within Frigate, I excluded areas where I don’t want to receive detection alerts from, and person detection above 70%.

How can I make the alerts in Telegram the same as within Frigate/ or reduce them:

  • person detection above 70%
  • only alert if person, dog, and cats are detected in certain areas
  • only alerts when I am not at home

Hopefully someone can help out?

Kind regards,

I tried editing the following script, but nothing worked for me.

  name: Frigate - Telegram Notification
  description: Create automations to receive Snapshots and Clips from Frigate
  domain: automation
      name: Frigate Camera
      description: The name of the camera as defined in your frigate configuration (/conf.yml).
      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.
      name: Notification
      description: 'Select "true" to disable notification, lave "false" to receive
          - 'true'
          - 'false'
      default: 'false'
      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: ''
      name: (Optional) Zone Filter
      description: Only notify if object has entered a defined zone.
      default: false
        boolean: {}
      name: (Optional) Trigger Zones
      description: A list (-) of zones you wish to recieve notifications for.
          - frigate/oprit_yard,
          - frigate/voortuin_yard,
          - frigate/achtertuin_yard
        object: {}
      name: (Optional) Trigger Objects
      description: A list (-) of objects you wish to recieve notifications for.
      default: []
        object: {}
      name: (Optional) Presence Filter
      description: Only notify if selected presence entity is not "home".
      default: ''
        entity: { }
mode: single
max_exceeded: silent
  platform: mqtt
  topic: frigate/events
  payload: !input 'camera'
  value_template: '{{ value_json[''after''][''camera''] }}'
  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'
- '{{ 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'') }}'
- service: telegram_bot.send_photo
    target: '{{ target_chat }}'
    disable_notification: '{{ notification }}'
    caption: |
      Motion detected. Camera: {{ camera_name }} (ID: {{ id }})
    url: >-
- repeat:
    - wait_for_trigger:
      - platform: mqtt
        topic: frigate/events
        payload: '{{ id }}'
        value_template: '{{ value_json[''after''][''id''] }}'
        minutes: 2
      continue_on_timeout: false
    - condition: template
      #value_template: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
      value_template: '{{ wait.trigger.payload_json[''type''] == ''new'' }}'
    - service: telegram_bot.send_video
        target: '{{ target_chat }}'
        disable_notification: '{{ notification }}'
        caption: 'Motion detected: {{ camera_name }}'
        url: >-
    until: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'

I don’t know if I understand your request correctly.

Frigate is the addon or service which identifies a picture and when it’s likely at 70 % that picture is a human being or dog?

I don’t really understand your coding. I would simplify the steps. Especially to have better debugging and trace details.

  1. I assume you are able to create a “dumb” sensor which has the last picture recognization value. Probably it exists already

  2. use / create a (binary) sensor which has true or false when you are at home.

  3. I don’t know where you get the condition “something in defined areas” but this shouldn’t be an issue. Worst case its a template sensor

  4. create an automation with

  • trigger “sensor value” above 70 (step as described in 1) )
  • condition combined with “and”
    – “something” identified in area
    – you are not at home
  • as action notify using predefined channel like telegram, email or whatever you define

this are my 2 cents. Sure, you can make this using script as well but using predifined steps in the automation gives you all the state in the trace