Frigate telegram Image Notification UndefinedError: 'dict object' has no attribute 'payload_json'

Hello all,

I’ve recently installed a CCTV camera and integrated it into home assistant with frigate and it is working very well.
It also detects Humans, which I now want to have a notification every time a human is detected.
The notification needs to be send with Telegram and should include a snapshot of the detected person.
I tried different templates and snippets of code but can’t get the code to work,
it gives me a UndefinedError: ‘dict object’ has no attribute ‘payload_json’
I have other automations that include the telegrambot so that’s working.
Here’s my YAML code:

alias: Telegram People Snapshot
description: ""
trigger:
  - type: occupied
    platform: device
    device_id: d2f509919252e9b70434fd53c7f7f31b
    entity_id: 6d865b49948d078043fb7cb0ff9e3b04
    domain: binary_sensor
condition:
  - condition: template
    value_template: "{{ trigger.payload_json['after']['label'] == 'person' }}"
    enabled: false
action:
  - service: notify.telegram_bot
    data_template:
      message: A {{trigger.payload_json["after"]["label"]}} was detected.
      data:
        photo:
          - url: >-
              http://homeassistant.local:8123/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg
            caption: >-
              A {{trigger.payload_json["after"]["label"]}} was detected on {{
              trigger.payload_json["after"]["camera"] }} camera
mode: single

Can anyone guide me towards a solution?
Thanks in advance.

Your only 1 trigger above is a binary sensor so there is no trigger json.

You would need to trigger off the frigate events for this to work.

1 Like