Difficulty with MQTT Triggers

I have been trying to get the following automation to trigger:

alias: Person in Garage
description: Person detected in garage
triggers:
  - trigger: mqtt
    topic: frigate/events
    payload: "True"
    value_template: >
      {{ payload_json['type'] == 'end' }}


actions:
  - action: notify.mobile_app_doug_12
    data:
      message: >-
        Person detected in garage.  Type: {{ trigger.payload_json['type'] }}
        Label: {{ trigger.payload_json['after']['label'] }}
mode: single

However, it never fires unless I remove the payload and value_template lines. If I ever get it working, I will add a couple more conditions to the value_template, and it should evaluate to True if all the conditions are true. All the conditions will inspect the mqtt payload.

Syntax issue. Your conditions block doesn’t make any sense.

I think you can put the payload simply into the trigger, like:

alias: Person in Garage
description: Person detected in garage
triggers:
  - trigger: mqtt
    topic: "frigate/events"
    payload: "True" 
actions:
  - action: notify.mobile_app_doug_12
    data:
      message: >-
        Person detected in garage.  Type: {{ trigger.payload_json['type'] }}
        Label: {{ trigger.payload_json['after']['label'] }}
mode: single

Not sure whether True should be capitalized.

If you want to apply additional logic to the MQTT input, what do you want to do? How to handle it depends on what you want to do.

You are correct, i pasted the wrong version of the template in. Fixed.

payload: “True” does not work, as I need the script to trigger only when trigger.payload_json['type'] is true (and once that is working, if the source is from a specific camera which will be another condition).

This seems to work. Microsoft Copilot gave me all sorts of wrong advice on making this template.

alias: Person in Garage
description: Person detected in garage
triggers:
  - trigger: mqtt
    topic: frigate/events
    payload: "True"
    value_template: |
      {{ value_json['type'] == 'end' }}
actions:
  - action: notify.mobile_app_doug_12
    data:
      message: >-
        Person detected in garage.  Type: {{ trigger.payload_json['type'] }}
        Label: {{ trigger.payload_json['after']['label'] }}
mode: single

Real shocker there.