#HA notification/mqtt questions
1 messages · Page 1 of 1 (latest)
makin a thread
Currently:
alias: Person at door
description: ""
trigger:
- platform: mqtt
topic: frigate/events
condition:
- condition: and
conditions:
- condition: template
value_template: "{{ trigger.payload_json['type'] == 'end' }}"
- condition: template
value_template: "{{ trigger.payload_json['after']['label'] == 'person' }}"
- condition: template
value_template: "{{ trigger.payload_json['after']['camera'] == 'front' }}"
- condition: template
value_template: "{{ 'door' in trigger.payload_json['after']['entered_zones'] }}"
- condition: template
value_template: >-
{{ as_timestamp(now()) -
as_timestamp(states.automation.person_at_door_immediate.last_triggered
| default('2020-01-01')) > 300 }}
action:
- service: notify.pushover
data:
message: Person at door
data:
attachment: >-
/littleboy/frigate/clips/{{trigger.payload_json["after"]["camera"]}}-{{trigger.payload_json["after"]["id"]}}-clean.png
url: >-
https://frigate.xxxxx.com/api/events/{{trigger.payload_json["after"]["id"]}}/clip.mp4
- service: input_datetime.set_datetime
data:
entity_id: input_datetime.person_at_door_immediate_lastfired
datetime: "{{ now().isoformat() }}"
mode: single
Maybe I should switch everything to the HA integration if it is easier?
what you are describing is basically what I have
one notification when an object first enters a zone and then another when it is ended
Oh nice
Damn there is a lot to unpack there 😄
Oh cool so there is a picture available
What options allow attachment: /api/frigate/notifications/{{ id }}/snapshot.jpg this to work?
I have 2 folders, clips and recordings.
Oh, maybe clips is the one in my config?
Ok it's working, the only thing I can't match from your config is the image for the initial firing. You're using /api/frigate/notifications/{{ id }}/snapshot.jpg which doesn't match my folder structure at all. You have a subfolder for id
This is my local folder structure
-rw-r--r-- 1 root root 843K Dec 28 11:07 front-1703779624.25334-ry5d1a-clean.png
-rw-r--r-- 1 root root 90K Dec 28 11:07 front-1703779624.25334-ry5d1a.jpg
xxx@elvis:/littleboy/frigate/clips$
Will local images be available? I guess I can copy yours since I now have the HA Frigate integration, so I should be able to copy what you have done?
Ok, copying yours did not work.
I guess I've achieved the primary goal - chime when first detected, then follow up video when event is over. If there is a way to have that initial picture like you have, even better, but I'mt not sure what to check on.
I can see the local image is not written until the event is over, so I'd need to get the /api format that you have working.
Interesting, I found this via HA media browser.
/api/frigate/frigate/snapshot
Ah, so I am using Pushover notification, which must use local files for attachments, not URL's.
So I guess not it's a non-frigate issue. This is downloading the file OK, but it's not being sent with pushover.
sequence:
- service: downloader.download_file
data:
overwrite: true
url: >-
http://localhost:8123/api/frigate/notifications/{{ id
}}/snapshot.jpg
filename: cam-pre.jpg
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- service: notify.pushover
data:
message: Person at door (pre)
data:
attachment: /config/downloads/cam-pre.jpg
all fixed. will add to your GH
timeout: "00:02:00" does this achieve rate-limiting of notifications?