Frigate Mobile App Notifications 2.0

Trying to make this Frigate Notification BP work but as of now, I have to declare it unreliable with no way for me to “configure the problem away”.

Scenario:

A person walks past parked cars into a zone leading to my porch.
Frigate correctly creates an Event for the person entering the zone
This notification BP often does NOT create a notification.

Every time this occurs, BP the trace shows a car object message being evaluated and correctly failing to match the notification criteria so the notification exits
The person object message is NEVER evaluated and no notification occurs, incorrectly.
I just replicated this test and subsequent failure three times in a row.
It appears that notification depends on the order of arrival and/or timing
of arrival of mqtt object messages.
If a person object message arrives first, or by itself, it is processed and a notification takes place. If, in my case, a car object message arrives first, the person object message is lost and no notification is possible.

It’s not clear to me exactly what can be done to resolve this, but the solution is to ensure all object messages are processed and evaluated, and no messages are lost or missed.

This is a fatal flaw for the real-world scenario described above. As much as I like the features of this Notification BP, I have to abandon it until this flaw is resolved and go back to my reliable notification and forgo the nice notification features because those features are useless without notification.
I’m happy to test any changes that are made in an attempt to fix this

Post the config please

Did you set it up from scratch? Post the config please.

Action buttons require you to hold the message on iOS

Everything works fine if the notification catches the right MQTT message

https://paste.debian.net/1309818/

So it’s not processing because of the cooldown most likely.

Do you need to track cars on the camera?

There are a heap of things you could try, I don’t know what’s best.
Some ideas:
Refine your zones and monitor for how/why frigate is detecting/sending car messages when people are the cause of motion
Setup object detection masks for cars where they are parked
Consider setting up a seperate camera in frigate for cars leaving a dedicated person camera.
Stop using cooldown.

A few of those really are dependant on what the camera can see and approach angles.

Bottom line:
Frigate detects people in zones and creates events as expected with everything configured as it is.
Frigate allows fine-grained tuning of detections via numerous tuning parameters
This BP does not reliably detect people and lacks tunability, so it often fails to notify.
This BP appears to miss object mqtt messages entirely.
I think it is futile to try to recreate Frigate detection logic in this BP
I have to revert to using Frigate detection events to trigger reliable notifications

Only if you want the same events as frigate detects. You are completely ignoring every other use case here in favour of your own.

The trigger is extremely simple. Mqtt message from frigate that’s says it’s a new event on the matching camera. That’s all that’s needed to start a trace. If you are missing traces it’s not really to do with the blueprint, but I don’t have an explanation either.

Like I said previously this Notification BP is nice but it doesn’t work reliably.
I can’t determine why it fails because I Iack the knowledge but I have repeated the failure multiple times and have described the failure scenario.
Fix it I’ll be happy to use it. Until then I’ll use my simple but reliable notification and I’ll add attachments and action buttons which are the most useful features of the BP for me.
I appreciate your effort but the failure to notify is a deal-breaker. If someone comes into my yard at 2:00 AM it is likely a bad thing and I need to know that reliably or there’s no reason to have security cameras with real-time person detection

There is a huge difference between failure to notify and failure to trigger. I can’t fix what you describe

1 Like

Your BP is triggering on incorrect events and missing desired events
If Frigate is creating events in HA and the BP is not detecting the same event and therefore not notifying, the BP is defective.
Every time the BP fails, the trace shows it processing a car object in the porch zone and then exiting. It never processes the person object, but Frigate sees it and creates a person in porch zone event in HA.

Clearly, I’m filtering on person in the porch zone

zones:
- porch
labels:
- person

Why does the BP not detect that event?

I believe it is due to your code missing the person object if it follows the car object in the mqtt message stream because in that scenario, I never see the person object in the trace. I know the person object was sent in the mqtt stream because a person in the porch zone event was created in HA

It triggers on any ‘new event’ Mqtt message that frigate sends, as designed.

Filtering happens much later. You keep stating that it isn’t triggering and the Mqtt messages are disappearing into the ether, that’s not the blueprint doing anything.

Trigger is the initiation. If the blueprint isn’t getting initiated, how can it process the person event

1 Like

I figured this out - just set a custom filter like this to only alert on matches with a score greater than 0.90:

{{ true if trigger.payload_json["after"]["score"] >= 0.90 else false }}

This way you can still record events with a lower score and only be notified when confidence is high enough that an object was detected!

Sorry I never saw your post 3 days ago.

Perfect use of the custom filter.

1 Like

All good! When I finally got a chance to look into it a bit more it turned out pretty easy to figure out. Is it something worth having as a configurable option in the template? I can create a PR if you’d like.

I think the options list is already long. What would be ideal is a good library of the available options to help people template in that custom filter area. I started the guide on GitHub ages ago but never had time to work through it.

Appreciate what our have been doing a lot

I have this setup and working for the most part. Love the extra features over the original. I have just tried to add an action button for view stream. When I press the button it sometimes opens the stream at a low frame rate. Other times I get 403: Forbidden.

Any ideas what is causing this and also how to improve the frame rate.

Thanks

I think new frigate integration changed where the token is stored in the camera entity. I’ve been working on a different template to retrieve the token sucessfully.

I think people will find when it says 403 forbidden. It’s either an old notification (the tokens expire) or it actually says token None at the end of the url.

Yes I think that it is the case. Only the last notification works for the live stream. I had cleared the notification and pressed view stream from previous notifications, giving the 403 error.

Any way to improve the frame rate? The stream is quite choppy.

Thanks

Hi @SgtBatten, I went away for work the other day and came back in the middle of the night. The camera detected a person (me), however, my notification didn’t work with this blueprint. Given my previous posts, what else could I be missing? I have the custom filter from earlier which works when testing it, I’m using booleans now instead of string literals, and I have filters turned on. What else could I be missing as to why it isn’t working?

Edit: Never mind, it seems to work when I changed the time to now and tested it. I reloaded the Frigate service prior in Home Assistant, so maybe that’s what fixed it. Great blueprint!

Is it possible to include the object (label) and zone filter in the main automation conditions? I think I experienced a problem because I have a cooldown set, however the automation is still triggered when an object different than those included is seen by frigate.

For example, my Blueprint has a filter for person but the automation could be triggered by a car which happened below. The automation stops as the filter doesn’t match.

But a few min later, when its triggered by a person it doesn’t execute due to the cooldown period. Do you think it’s possible to embed the zone/object filters in the automation conditions or does it need to be embedded for some other reasons?

alias: Frigate Event
conditions:
  - condition: trigger
    id: frigate-event
  - '{{ is_state(this.entity_id, ''on'') }}'
  - >-
    {{ not this.attributes.last_triggered or (now() -
    this.attributes.last_triggered).seconds > cooldown }}
  - >-
    {{ not disable_times|length or not now().hour in
    disable_times|map('int')|list }}