Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frigate 0.14 #216

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Frigate 0.14 #216

wants to merge 20 commits into from

Conversation

SgtBatten
Copy link
Owner

@SgtBatten SgtBatten commented May 29, 2024

Bugs

  • sub_labels not defined
  • "Person['person']" due to bad variable mapping
  • Notifications labeled with the wrong camera
  • Only get alerts IF zone filter switch is OFF (Possibly fixed) SOMEONE PLEASE CONFIRM
  • Short events result in an incomplete video being attached which often doesnt show the objects (delay needed?)
  • Turning on filters and selecting person causes all of my cameras NOT to send a notification.
  • Delay in notifications arriving

Features

  • user can set choose severity (alert or detection)
  • can attach the new review gif to the notification (pending frigate integration API update)
  • incorporate new tts options from main branch @djak250

To Do:

  • Update the loop to make it work with 0.14
  • confirm if the user choice of alerts/detections works
  • send message on end of event is video is meant to be send (best chance of recieving video)
  • one automation for multiple cameras (I have some ideas)
  • merge all changes that have been made in the main branch

Thoughts

  • Do we process it as a loop like the current frigate/events version, or process each message in frigate/reviews
  • Can it be built such that it supports both the review and event topics (user selection)

@HenningL-Atea

This comment was marked as resolved.

@Elder-HVAC-Man
Copy link

Elder-HVAC-Man commented Jun 2, 2024

Testing with HenningL's change. Only get alerts IF zone filter switch is OFF. Can't have any zones or object filters as well or automation does not fire. When it does fire, I get alerts on my iWatch, but no snaps or video.

Not sure if it helps, but error message from logs:

Logger: homeassistant.helpers.template
Source: helpers/template.py:2613
First occurred: 10:00:43 AM (3 occurrences)
Last logged: 10:00:43 AM

Template variable warning: 'new_snapshot' is undefined when rendering 'DEBUG (in loop): Send Notification: {{ custom_filter and not home and zone_filter and zone_multi_filter and state_true and (new_snapshot or presence_changed or zone_only_changed or entered_zones_changed ) }} Info: sublabel: {{sub_labels | join(', ')}}, image: "{{base_url}}/api/frigate{{client_id}}/notifications/{{events[0]}}/{{attachment}}" Title: {{title}} message: {{message}} iOS sound: {{'Critical' if critical else 'disabled by alert once' if alert_once else 'enabled'}}, Android Sound: {{'disabled by alert once' if alert_once else 'enabled'}}, iOS url: /api/frigate{{client_id}}/notifications/{{id}}/{{camera + '/clip.mp4' if video|length>0 and wait.trigger.payload_json['type'] == 'end' else attachment }} video: "{{video}}" critical: {{critical}}, Triggers: Presence Changed: {{presence_changed}}, Entered Zones Changed: {{'True' if event['before']['data']['zones'] != event['after']['data']['zones'] else 'False'}}{{' - Disabled' if not zone_only}}, Conditions: Filters: Zones: Zone Filter Enabled: {{zone_only}}, Multi Zone Enabled: {{zone_multi}}, Required Zones: {{input_zones}}, Last Zones: {{last_zones}}, Entered zones: {{enteredzones|list|length}} - {{enteredzones}}, TEST: {{'PASS' if not zone_only or (not zone_multi and zones|select('in', enteredzones)|list|length ) else 'PASS (Multi)' if zone_only and zone_multi and zone_multi_filter else 'FAIL (Multi)' if zone_only and zone_multi else 'FAIL' }}, Object Filter: Input: {{input_labels}}, TEST: {{'PASS' if not labels|length or object in labels else 'FAIL'}}, Presence entity (not home): Entity: {{presence_entity}}, TEST: {{'PASS' if not home else 'FAIL'}}, Time Filter: Disabled times: {{disable_times}}, TEST: {{'PASS' if now().hour not in disable_times else 'FAIL'}} State Filter: state filter toggle on: {{state_only}}, state filter entity: {{input_entity}}, required states: {{input_states}}, TEST: {{'PASS' if state_true else 'FAIL'}}, Custom Filter: {{'PASS' if custom_filter else 'FAIL'}},'

Trying to view clip on iPhone, I get this message:
{"message":"Event not found", "success": false}

@HenningL-Atea
Copy link

There are some inconsistencies with the alerts;

  • Alert tekst says "Person['person'] detected on the yard camera", probably parsing of detected objects label doesn't work as intended ( {{ label }} translates to Person ['person'] )
  • I get alerts from one camera, but with snapshot from another camera, seems like snapshot is correct, but camera name in alert is wrong.
  • Links for clips and snapshots doesn't work ("Event not found").

@SgtBatten
Copy link
Owner Author

There are some inconsistencies with the alerts;

Keep these coming, i appreciate it. Not much time so will update when i can. This is valuable though.

@HenningL-Atea

This comment was marked as resolved.

@SgtBatten

This comment was marked as resolved.

@Amadou91

This comment was marked as resolved.

@SgtBatten

This comment was marked as outdated.

@rroller

This comment was marked as outdated.

SgtBatten added 3 commits June 6, 2024 22:30
minor refactors

Removed loop for now to focus on core notifications, may be permanent. time will tell
refactor some of the code
@SgtBatten

This comment was marked as outdated.

@Elder-HVAC-Man

This comment was marked as resolved.

@SgtBatten

This comment was marked as outdated.

@SgtBatten SgtBatten marked this pull request as draft June 9, 2024 09:18
@SgtBatten
Copy link
Owner Author

Turning on filters and selecting person causes all of my cameras NOT to send a notification.

Fixed this

@rroller
Copy link

rroller commented Jun 10, 2024

Pulled the latest changes. Working great so far

@jacobrian

This comment was marked as resolved.

@SgtBatten

This comment was marked as resolved.

@jacobrian

This comment was marked as resolved.

@SgtBatten

This comment was marked as resolved.

@Iceman248
Copy link

I found it to just be on the 0.14.0.1 (e/f/g) versions. 0.14.0.1d worked for me with clips.

@kiloptero

This comment was marked as off-topic.

@Iceman248

This comment was marked as off-topic.

@kiloptero

This comment was marked as off-topic.

@Iceman248

This comment was marked as off-topic.

@kiloptero

This comment was marked as off-topic.

@Iceman248

This comment was marked as off-topic.

@kiloptero

This comment was marked as off-topic.

@kiloptero

This comment was marked as off-topic.

@SgtBatten
Copy link
Owner Author

The clips feature from this blueprint instead of snapshots or Android GIFs. It stopped working after 0.14.0.1d. I am using Frigate 0.15. The below link has my config in it.

this seems to be a frigate 0.15 thing as its working on frigate 0.14, please keep that discussion going in the other issue so i can get to it after we release this one.

@kiloptero
Copy link

kiloptero commented Nov 8, 2024 via email

@jake9190
Copy link

Also @jake9190 i;ve implemented a version of your suggestions above.

I noticed I've been missing notifications. It looks to be a result of the severity changing during an update type (e.g., detection -> alert) but this not being an allowed condition. I think there needs to be something like this as well:

severity_updated: "{% if trigger.id == 'frigate-event' %} \n\n {{ trigger.payload_json['before']['severity'] != trigger.payload_json['after']['severity'] }}\n{% endif %}\n"

@SgtBatten
Copy link
Owner Author

okay good idea. otherwise it needs to keep waiting for one of the other update requirements before a notification gets sent. this essentially allows the first time it changes to notify you.

@saucedge
Copy link

Hi guys, I have been running 0.14.0.1a for a while and it's been working well. But, I tried adding notifications for another camera that has enough alerts that I tried using the Silence action for the first time an had issues. I just upgraded to 0.14.0.1g and see the same behavior... but I'm not sure if this is a 0.14 issue or an issue with my config.

The issue: with a brand new stock automation adding only the Frigate Camera and Mobile Device, the alert generates a notification with thumbnail as expected. But, when I tap the Silence action in the notification, another notification is immediately generated with the same thumbnail and an error is logged in Home Assistant. I think the error changed in "g" compared to "a"... but again, the new error could just be because I tried to create a clean new automation with the "g" blueprint. The automation traces for "g" only show frigate-event triggers and no silence triggers. With either blueprint, the automation is never turned off after tapping Silence.

The "g" error:
image

The "a" error:
image

I did find another thread somewhere that said silence was not working when camera entity names had "_2" appended since those were getting stripped somewhere. And, my camera names DID have "_2" since my original deployment of Frigate overlapped with existing camera names. But, I have manually renamed the camera entities in Home Assistant to truncate the "_2"'s which I thought would have solved that issue.

Any ideas if this might be a 0.14 issue or if I should go to the stable branch and troubleshoot from there? Thanks!

@SgtBatten
Copy link
Owner Author

Hmm, I just hit my custom action button on a notification i got 20 mins ago and it worked.

That error is suggesting "this" = None. but this = the automation itself, like the automation entity within HA. It's can't not have an entity id so i'm a little confused there.

not working when camera entity names had "_2" appended since those were getting stripped somewhere.

Not any more, frigate added a feature which helps me get accurate cam names now.

@Iceman248
Copy link

With the major update from 11/2, I like being able to add multiple cameras to the same automation, but I have noticed since that I am missing some notifications entirely if there is an event back to back on different cameras. Perhaps the cooldown is affecting it? I tried with it off and it worked, then back on and it didn't, but it has sometimes worked with it on, maybe even most of the time or 50/50.

One other thing I have noticed and I am not sure if it related to the same update, but sometimes the wording about the camera and object/time in the notification is there and sometimes it isn't. Sometimes it's part of the first notification and then disappears after an image update, sometimes it's not there for the first either.

@saucedge
Copy link

I am using Frigate 0.15.0-33825f6 now; maybe I need to roll back to the latest stable there to give useful feedback?

@saucedge
Copy link

saucedge commented Nov 12, 2024

I just tried again with all the same versions and got no error, but the Silence action did not trigger the automation at all this time. Listening to the events directly, I see this:
image

Does anything stand out as investigateable there? It sure looks to me like the trigger should be satisfied by that event...

@saucedge
Copy link

Well crap... there were no errors when I was generating those screenshots... but now there are errors again:
image

@SgtBatten
Copy link
Owner Author

SgtBatten commented Nov 13, 2024

Perhaps the cooldown is affecting it

yes cooldown will of course block lots of things with this blueprint as there is no loop function yet. it will even block updates to the notification. Don;t use cooldown currently, and probably don't use it if using multiple cameras.

@aaronjrodrigues
Copy link

aaronjrodrigues commented Nov 20, 2024

image I've noticed that in this part of the blueprint configurator, it seems that it shows the code for the default notification message instead of an output of what the default message e.g "A person was detected on the front camera". Is this intended behavior?

@SgtBatten
Copy link
Owner Author

I've noticed that in this part of the blueprint configurator, it seems that it shows the code for the default notification message instead of an output of what the default message e.g "A person was detected on the front camera". Is this intended behavior?

Yes, in the sense that it's showing you you have a setup that is not the same as any of the ones in the list. I may have changed the default since the last time you updated and as you did an upgrade and not a clean install, it's showing you your custom entry

@aaronjrodrigues
Copy link

aaronjrodrigues commented Nov 21, 2024 via email

@SgtBatten
Copy link
Owner Author

When upgrading I did a clean install as I deleted the old automation and blueprint and installed the new blueprint and created a new automation from scratch again.

In that case I think I need to change something, likely the default value doesn't match the list items.

@ppetro08
Copy link

I was having issues with notifications coming in delayed, so I turned on Persistent connection -> Always and now I receive 2 notifications. The first one will be a notification with the image but no text and the second notification is the text but no image. I can confirm there was only one trace each time.

Before changing the persistent connection to always, I did notice I would hear 2 notification sounds for a single event but did not see 2 separate notifications.

Here is my config, I can share more of the trace as well if needed.

alias: Frigate Notifications (0.14.0.1f)
description: ""
trace:
  stored_traces: 40
use_blueprint:
  path: SgtBatten/Beta.yaml
  input:
    camera:
      - camera.doorbell
    notify_device: ***
    notify_group: all_phones
    attachment: snapshot.jpg?bbox=1
    message: >-
      {{ label }}{{ ' was' if type == 'end' else '' }} detected on the {{
      camera_name }} camera{{' in the ' if after_zones|length}}{{ after_zones |
      join(', ') | replace('_', ' ' ) | title }}.
    update_thumbnail: false
    icon: mdi:doorbell-video
    tap_action: app://com.mcu.reolink
    debug: true
    alert_once: true
    cooldown: 0
    video: ""
    initial_delay: 2
    critical: "true"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.