Hello,
I’m new to HA automation and trying to understand whole idea.
Right now I have only one integration - with frigate. Frigate is installed on separate container if that is important.
I’m trying to set telegram notifications - that was the only thing that comes to my mind that I can try without having whole bunch of smart devices.
So below is my automation setup:
alias: Notify on Person Detection
trigger:
- platform: mqtt
topic: frigate/events
condition:
- condition: template
value_template: >-
{{ trigger.value_json['after']['label'] == 'person' or
trigger.value_json['after']['camera'] == 'GARAGE_1' }}
action:
- service: notify.ha_bot
data:
message: Person movement detected on the GARAGE_1 camera!
photo:
- url: >-
http://192.168.0.23:5000/api/frigate/notifications/{{
trigger.payload_json['after']['id'] }}/snapshot.jpg
caption: A person was detected on the GARAGE_1 camera.
mode: single
While trying to trigger that automation I’m receiving:
Error: In ‘template’ condition: UndefinedError: ‘dict object’ has no attribute ‘value_json’
If I’m right it means that I’m not receiving expected data - whether format is invalid and/or there is no data at all.
So I’ve tried to remove conditions and check if this will work while only watching at frigate/events - and it worked but of course without passing any data to url in action.
This is what I see in MQTT explorer - it looks fine for me.
Here you can find json: Codebin - frigate event
I’ve tried to change my automation in different ways but I’m always failing with this error.
Could you please advise what I’m doing wrong?