H
HASS.Agent5mo ago
Ani

Frigate notification to HASS.Agent

as the title says, I want an automation that sends a notification to my windows pc via HASS.Agent. I've tried changing the notify.device entity in the automation but the Frigate blueprint seems to only work with mobile or any devices with the HA app installed.
21 Replies
Ani
AniOP5mo ago
the action seems like it should work
action:
- action: notify.my_pc
metadata: {}
data:
message: Motion Detected
title: Front Door
image: >-
https://[public HA link]]/api/frigate/notifications/{{trigger.payload_json["after"]["data"]["detections"][0]}}/thumbnail.jpg
action:
- action: notify.my_pc
metadata: {}
data:
message: Motion Detected
title: Front Door
image: >-
https://[public HA link]]/api/frigate/notifications/{{trigger.payload_json["after"]["data"]["detections"][0]}}/thumbnail.jpg
but i get Error rendering data template: UndefinedError: 'trigger' is undefined and I'm not sure how the trigger should be laid out I'm also not sure if the automation would only work when the actual event occurs and I can't just have it fetch the most recent image if I run the action manually
barrelltitor
barrelltitor5mo ago
whats your full auttomation or whats your trigger first thing that comes to mind is to check the docu if there's actually a payload_json[after][data][detections][0] if it says trigger is undefined its probably in another variable can you send me the blueprint too maybe? a link to it would be good, i can see if there's any relevant documentation
Ani
AniOP5mo ago
I managed to get the notification to pop up with this automation but there was no image - I may need to adjust the link:
alias: PC Notif Test
trigger:
- platform: mqtt
topic: frigate/events
condition:
- condition: template
value_template: "{{ trigger.payload_json['after']['label'] == 'person' }}"
action:
- data:
title: Frigate Person Detection
message: >
"Frigate detected a person on the {{
trigger.payload_json['after']['camera'] }}."
data:
image: >-
https://[Link]/api/events/{{
trigger.payload_json['after']['id'] }}/snapshot.jpg
action: notify.my_pc
alias: PC Notif Test
trigger:
- platform: mqtt
topic: frigate/events
condition:
- condition: template
value_template: "{{ trigger.payload_json['after']['label'] == 'person' }}"
action:
- data:
title: Frigate Person Detection
message: >
"Frigate detected a person on the {{
trigger.payload_json['after']['camera'] }}."
data:
image: >-
https://[Link]/api/events/{{
trigger.payload_json['after']['id'] }}/snapshot.jpg
action: notify.my_pc
Ani
AniOP5mo ago
this was without the blueprint entirely, but this is the one i was going to try and alter https://community.home-assistant.io/t/frigate-mobile-app-notifications-2-0/559732
Home Assistant Community
Frigate Mobile App Notifications 2.0
Preamble In 2022, a home assistant release caused issues with the original blueprint. It seems @hunterjm has not visited that thread in some time. I have updated the blueprint and added dozens of new features. I am continuing to do so and the mods have split the thread here to make things simpler. Thank you very much Hunterjm for the foundationa...
barrelltitor
barrelltitor5mo ago
Yeah trigger undefined was definitely a problem, but if it works now you just need to play around with the data I don't have ffrigate myself so idk there,e if you can give me the trigger object i can help figure it out, and an example link If you need help with that in the first place ofc
Ani
AniOP5mo ago
yeah it's just a matter of getting the image to appear
Ani
AniOP5mo ago
right now it's just this
No description
Ani
AniOP5mo ago
so i think i need to mess with the variables looks like the link is correct as https://[link]/api/frigate/notifications/[event id]/snapshot.jpg i just need to get the event id to replace it as a variable
DrR0x
DrR0x3w ago
Get this working?
Ani
AniOP3w ago
Nope unfortunately not. Haven't touched it in a while
DrR0x
DrR0x3w ago
I use this myself, got a notification 10 mins ago, so i'll have a look and see if we can get yours working. Have you updated recently? Forked integration and 2.1.0?
Ani
AniOP3w ago
Haven't updated in a while as I was away for Christmas. Are you able to share how you got it to work?
DrR0x
DrR0x3w ago
Yeah just working on my server, will grab config once its running again
Ani
AniOP2w ago
hiya mate, were you able to have a look at this? i'm planning to get a reolink doorbell so i'm hoping to get that working over frigate
Cake1468
Cake14682w ago
@Ani I've got this mostly working, so I'll dig up the details in a moment. I came looking for info about getting the URI: links working as they don't seem to be getting passed to the browser, but I do get notifications with a snapshot, so partially there.
Ani
AniOP2w ago
awesome mate! thanks for chiming in looking forward to seeing it
Cake1468
Cake14682w ago
Alright @Ani see if this helps: https://pastebin.com/r2HgEAbt
Pastebin
Add this to your configuration.yaml:```#Notification Groupsnotify: ...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
DrR0x
DrR0x2w ago
@Cake1468 assuming this is your original code would I be able to use it on the docs? Will just paste it as an example, frigate and stuff is too niche to do as part of actual docs, but will have a page of examples with links like yours. Will credit obvsly.
Cake1468
Cake14682w ago
Yes, Happily! The second part is YAML generated from SgtBatten's blueprint, but the rest and comments are mine. I hope it all makes sense with the places to change things. I understand {insert change here} is common, but with HA templates I got a little concerned people might not change them and think they were part of the code itself. Might you have time sometime to work with me to figure out why the links from the notification buttons don't seem to be working? That would be the cherry on top for this component. Also, if it's for a doc, I should probably clean up that BP YAML a little. There are a few lines that I don't think are needed. You're welcome to include it anytime, and I'll send you an update once I've dialed it in.
Cake1468
Cake14686d ago
@DrR0x Here's an edit of what I posted the other day that's a little cleaned up: https://pastebin.com/bPjp2BSA
Pastebin
Frigate Notifications Blueprint with HASS Agent - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Cake1468
Cake14686d ago
if you'd be so kind as to take a look when you have an opportunity. I have the following from a trace that triggered a notiifcation to HASS Agent correctly, with a snapshot as desired, however nothing happens when you click the bottons. https://pastebin.com/PcJ1h9qa If I copy the URLs and paste them into the browser I can access the live stream or recording as desired. In HASS Agent I have the following settings for "External Tools", and "Test" works to open the browser in the correct profile as desired. However, nothing happens when I click the links. Here's a MQTT that displays a notificaiton https://pastebin.com/BPFdcx8S I just happend to have MQTT Expored open, and when I clicked a link, this showed up:
{"action":"URI","input":null,"uri":"https://lab.com/api/frigate/notifications/1738197645.585237-3hg80z/frigate_lorex_01_gate/clip.mp4"}
{"action":"URI","input":null,"uri":"https://lab.com/api/frigate/notifications/1738197645.585237-3hg80z/frigate_lorex_01_gate/clip.mp4"}
Perhaps I have the notification Blueprint configured wrong so that instead of opening the link it sends an MQTT message? I tried both 'URI' which is what the blueprint defaults to, and "uriopen" which is suggested in the HASS Agent docs.
Pastebin
Frigate/Hass Agent Troubleshooting 2 - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
Frigate/Hass Agent Troubleshooting 1 - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

Did you find this page helpful?