Local realtime person detection for RTSP cameras

You can also remove the healthcheck entry too. It is not necessary.

Some else just figured out your issue: https://github.com/blakeblackshear/frigate/issues/340

Hmmā€¦ Removing those health check entries didnā€™t do it. But I did add the version to the top like so which works:

version: "3"
services:
  frigate:
      container_name: frigate
      ...

Now I guess I need a MQTT server, correct?

I think itā€™s a single vs double quote issue.

    - "{{ trigger.payload_json['after']['label'] == 'person' }}"
    - "{{ 'oprit' in trigger.payload_json['after']['entered_zones'] }}"

has anyone using node-red refactored notifications based on teh new API endpoints? Up until now, Iā€™ve been triggering off of the sensor.camera_person sensor > 0. When triggered, Iā€™d simply use the snapshot service to grab a pic of the mqtt camera stream and stick it in the www folder before sending the notification. Iā€™m thinking thereā€™s now a more elegant way to do this using the https://your.public.hass.address.com/api/frigate/notifications/ endpoint?

Iā€™m thinking I should now start listening to frigate mqtt events instead that way i can grab the JSON data? Iā€™ll start poking around tonight.

EDIT: ok that was easy

That was the whole point of the refactored MQTT topic and the notification API. No need to save snapshots anymore. I wanted to make it so simple YAML automations could be used instead.

Think I got something here. I couldnā€™t get an image through to an ios notifcation using the data.data.image method in your examples, but I find data.attachment.url works great. Here it is in node-red:

{
    "title": "SECURITY NOTIFICATION",
    "message": "Person detected at the {{payload.after.camera}}",
    "data": {
        "attachment": {
            "url": "https://my_url.com/api/frigate/notifications/{{payload.after.id}}.jpg",
            "content-type": "jpeg"
        }
    }
}

It seems like on detection generates a lot of events on the bus though, right? Not every event is generating a thumb is it?

1 Like

It publishes an update for the event when a better representation of the detected object is available. It is looking at size, age, and score to determine what is better. The endpoint doesnā€™t actually fetch a real ā€œfileā€ from disk. When the event is in progress, it creates it on the fly from the in-memory frame. Once the event is over, it pulls it from the database. So no, its not generating a bunch of thumbnails.

That reminds me that I need to make sure I push an update if entered zones change.

1 Like

@hasshoolio what about this? The timestamp fills the first line perfectly.
image

I think that is nice! Does it follow HA region and formatting? MDY VS DMY, 12hr vs 24hr time, etc)

I was thinking about what other information would be useful and had two thoughts.

  1. Duration would be good.
  2. Some type of object id, or a way to identify which object is in the video. Since multiple objects in frame will trigger individual recordings, a way to distinguish between the recordings could be handy.

I think we are going to get outside the bounds of what is reasonable to show in the media browser names. I donā€™t get to control line breaks for formatting at all. I could look at adding some info as an overlay on the thumbnail too.

Just putting my hand up here as another person who does not use Home Assistant but has been using frigate successfully, in my case via node red and MQTT. It would be good if these use cases could continue to be supported.

The new beta looks to be addressing several things I had been looking for (especially detection with low res stream and recording clips with high res stream) but it would be good if MQTT support could continue independent of the HA integration so we can access outside HA. For example, having clips or at least their paths published to MQTT.

1 Like

Iā€™m using the mqtt node to listen for events from 0.8.0 and it works great. I parse the json event data and return it as an object that can be easily managed. I posted a screen shot a few posts back.

Agreed, only if thereā€™s a good way to present it, those things may be useful. Time will tell as the feature is released and gets real-world use.

Trying to use the latest version but my docker run command resulted in below logs error:

 * Starting nginx nginx
   ...done.
frigate.app                    ERROR   : database is locked

Any idea what causes this issue?

I havenā€™t run across that yet, but it is referring to the sqlite database at /media/frigate/clips/frigate.db. This happens on startup?

I had this problem too when trying to move my clips folder to a samba share. Iā€™m assuming it has something to do with permissions on the share. Whatā€™s strange is that frigate was able to create the two database files in the clips folder. It just wasnā€™t happy about it for some reason.

I need to spend more time poking around. In the meantime, I just went back to writing to the local drive.

Planning on giving 0.8.0 beta a try later today. Two of my cameras are pretty cheap - they donā€™t have a low-res subfeed and lack the ability to change the framerate. Should I expected degraded performance? Any suggestions to get the most out of it?

Yes, you are right, might be an idea to update the notification example in github.

Iā€™ve also a kind of de-bounce condition (60seconds) as it was otherwise sending out multiple messages for a single event.

- alias: "when a person enters oprit"
  trigger:
    platform: mqtt
    topic: frigate/events
  condition: 
    - "{{ trigger.payload_json['after']['label'] == 'person' }}"
    - "{{ 'oprit' in trigger.payload_json['after']['entered_zones'] }}"
    - "{{ ( as_timestamp(now()) - as_timestamp(state_attr('automation.when_a_person_enters_oprit', 'last_triggered')) |int(0) ) > 60 }}"
  action:
    - service: notify.telegram_YJB
      data:
        message: "A {{trigger.payload_json['after']['label']}} has entered the oprit."
        data:
          photo:
            - url: "https://<valid_internet_domain_name>/api/frigate/notifications/{{trigger.payload_json['after']['id']}}.jpg"
              caption: "A {{trigger.payload_json['after']['label']}} has entered the oprit."

Thanks again!

3 Likes

Iā€™m using a basic wyze 2 with the defang hacks firmware. It has no substream and things are working fine at 10fps. Iā€™ using all roles but recording.

I think youā€™ll be fine.

1 Like