Local realtime person detection for RTSP cameras

I would open an issue on GH so we can see your config. This is usually because you didn’t add the labels to the list of things to track.

I’m not sure I follow here. For my user case maybe it’s not important to actually use the object detection at all. Since I don’t have a coral anyways I might save my CPU some to just disable it?

How do I go about just recording and doing a snapshot with motion only, not object detection? As of my setup right now it recorded motion but did not create any event or snapshot off it.

You can’t. Events are exclusively for detected objects, not motion. Set your recording retention mode to motion and use the recordings viewer to just watch the parts with motion.

1 Like

how to pass url like /dda74ggd_frigate-proxy/events?camera=cam to frigate proxy? it keeps resetting to /dashboard and ignoring it…

I stopped trying and just went to frigate directly.

i had to come up with this nasty mess, including the following changes to frigate;

requires access to frigate source running as docker, or similar setups. basically you have to modify web/src/routes/Cameras.jsx… heres what i did:

edit Cameras.jsx with the following changes

  1. add these lines below all the other imports
import { route } from 'preact-router'; //CHANGES
import { useState, useEffect } from 'preact/hooks'; //CHANGES
  1. right below that, change export default function Cameras() {
    into
    export default function Cameras({ path, ...props }) {

  2. add this mess right below const { data: config } = useSWR('config');

  if(props.page)
  {
    const [show, setShow] = useState(false) 
    useEffect(() => {
      const timeout = setTimeout(() => {
        setShow(true)
      }, 1000)

      return () => clearTimeout(timeout)

    }, [show])

    if (!show) return null
    
    const fixer = String(props.url).split('?page=').pop().replace('&', '?');
    route(`${fixer}`);
  }
  1. cd into your frigate/web directory
  2. execute npm run build
    5a. if you havent or theres trouble, do npm install first, good luck with node version errors
  3. execute docker compose down ,very important as docker compose restart or docker compose up will not carry over changes for some stupid reason
  4. execute docker compose up --build -d
  5. verify it works by going to http://frigate:5000/?page=events&camera=CamName&label=person etc,etc. This should open up the events page and filter events showing only CamName persons.
    8a. Note: the arguments for frigate events as of 12/15/2022 from github repository are different, they are: ?page=events&cameras=CamName&labels=person

now you can pass a “?page=” url argument to frigate and it will take you to that page and pass arguments.
so the webcard can have /api/ha_ingress/randomstring/?page=events&camera=Cam&label=car and frigate will navigate to events and what not on its own without outside help.

More ugly hacks but i don’t see no one else trying to solve this…

1 Like

I’m impressed you worked that all out in a day

1 Like

You can adjust detection parameters to reduce cpu use i believe.

https://docs.frigate.video/guides/false_positives

1 Like

Hi @SgtBatten, I’m using your blueprint and sometimes I’m getting “timeout” screenshots in the notifications. I’m on iOS. Any guess why and how to troubleshoot that, please?

The car was loitering…

Here is the diagnostic trace of the automation: frigate-notification-error-20221215 - Pastebin.com

Thanks a lot for all the work you’ve done with the blueprint!

If it’s only happening sometimes it seems like it is likely a connection issue more than anything else. I occasionally get notifications without thumbnails on my android phone too.

Happy to discuss further in the blueprint thread if you like. The trace looks normal at a quick glance.

Hi there. I’m really reluctant to reply to this particular thread with such a targeted question but it looks like on these forums that starting new threads isn’t too common. So my apologies if posting here is not correct.

I’m having trouble with what I think is a basic functionality of Frigate<->HA. I cannot seem to get a binary_sensor created to track the status of motion for a particular camera and object combo. Cameras are working great, recording/snapshots/people detection working just fine. Without making any changes, I can see binary_sensors for __occupancy, but that seems to stay triggered for awhile and doesn’t feel like it’s the standard ‘detected motion’ approach, say, that PIR would use. Is it possible to create a binary_sensor that would toggle when “front driveway” camera detect “person”?

I did find a reply upthread that seemed to provide some basic MQTT config and I intuited that those config stanzas would add the binary_sensors, but no joy. A few screenshots attached… Could someone help point me in the right direction? Much appreciated.

In mqtt.yaml:

Frigate gives you them as sensors, you are not seeing them because you are only looking at binary sensors.

sensor.front_driveway_person_count

Ah, okay. I did note that sensor earlier (one for each of the objects setup in the detect config for each camera). However as the name of the sensor implies it appears to be a counter. Looking at the history it does seem to increment > 1 when there are multiple instances so this isn’t quite as real-time as I was hoping. Many of the Youtube setup videos for Frigate/Home Assistant make reference to and show a binary_sensor exposed that’s sort of a ‘toggle’ turned Detected/On at the start of motion for a specific object, but I could just be misunderstanding. So it appears there is an occupancy sensor, which will last for a bit, a counter which likely increments at the onset of motion for an object, but there is not a simple on/off motion binary_sensor? Obviously no problem either way, just want to be sure I understand. Thanks again!

It used to, the YouTube vids are out of date.

The count is very much real time so you can use it just like a binary sensor. If it’s >0 its true

Thanks very much!

I have a Blackvue vehicle dash cam which displays a live view at the following URL (when connected to local WiFi): http://192.168.x.yyy/blackvue_live.cgi

thought it would be fun to try to get it into Frigate also. (Stream opens fine in VLC!)
attempted to copy the advice here: [Support]: How to connect http video stream to frigate (green screen) · Issue #2673 · blakeblackshear/frigate · GitHub
and here (MJPEG cameras): Camera Specific Configurations | Frigate

but it doesn’t work & I don’t really understand what I am doing re. the settings, tbh
Any pointers?

Any reason i am getting IP Banned when accessing my lovelace dashboard that has the frigate lovelace card enabled?

Logger: homeassistant.components.http.ban
Source: components/http/ban.py:83
Integration: HTTP ([documentation](https://www.home-assistant.io/integrations/http), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+http%22))
First occurred: 11:06:10 (8 occurrences)
Last logged: 11:06:10

* Login attempt or request with invalid authentication from 192.168.1.51 (192.168.1.51). Requested URL: '/api/frigate/frigate/thumbnail/1671606312.399544-fp7nra'. (Mozilla/5.0 (iPhone; CPU iPhone OS 16_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Home Assistant/2022.10.1 (io.robbie.HomeAssistant; build:2022.424; iOS 16.3.0) Mobile/HomeAssistant, like Safari)
* Login attempt or request with invalid authentication from 192.168.1.51 (192.168.1.51). Requested URL: '/api/frigate/frigate/thumbnail/1671547421.152737-yga5c8'. (Mozilla/5.0 (iPhone; CPU iPhone OS 16_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Home Assistant/2022.10.1 (io.robbie.HomeAssistant; build:2022.424; iOS 16.3.0) Mobile/HomeAssistant, like Safari)
* Login attempt or request with invalid authentication from 192.168.1.51 (192.168.1.51). Requested URL: '/api/frigate/frigate/thumbnail/1671547172.258293-cyqr7z'. (Mozilla/5.0 (iPhone; CPU iPhone OS 16_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Home Assistant/2022.10.1 (io.robbie.HomeAssistant; build:2022.424; iOS 16.3.0) Mobile/HomeAssistant, like Safari)
* Banned IP 192.168.1.51 for too many login attempts
* Login attempt or request with invalid authentication from 192.168.1.51 (192.168.1.51). Requested URL: '/api/frigate/frigate/thumbnail/1671547416.713971-nb2twv'. (Mozilla/5.0 (iPhone; CPU iPhone OS 16_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Home Assistant/2022.10.1 (io.robbie.HomeAssistant; build:2022.424; iOS 16.3.0) Mobile/HomeAssistant, like Safari)

Edit, seems to be related to the out of date card. Now fixed updating to 4.0.0

Any indictaion of why the current_zones is empty in the after object of my MQTT message? It’s screwing up my automations. Based on the “box”, the object is clearly in one of my zones (and also meets all the filtering requirements for that zone). Ironically, in the very next MQTT message, the current_zones was populated correctly in the before object.

{"before":{"id":"1672102387.274661-4gigs3","camera":"driveway_cam","frame_time":1672103572.98488,"snapshot_time":1672103572.523118,"label":"car","sub_label":null,"top_score":0.84375,"false_positive":false,"start_time":1672102387.274661,"end_time":null,"score":0.71484375,"box":[367,111,503,256],"area":19720,"ratio":0.9379310344827586,"region":[175,0,535,360],"stationary":false,"motionless_count":5,"position_changes":3,"current_zones":["street_zone"],"entered_zones":["street_zone"],"has_clip":false,"has_snapshot":false},"after":{"id":"1672102387.274661-4gigs3","camera":"driveway_cam","frame_time":1672103574.78718,"snapshot_time":1672103574.78718,"label":"car","sub_label":null,"top_score":0.84375,"false_positive":false,"start_time":1672102387.274661,"end_time":null,"score":0.7265625,"box":[350,132,539,317],"area":34965,"ratio":1.0216216216216216,"region":[251,34,635,418],"stationary":false,"motionless_count":2,"position_changes":3,"current_zones":[],"entered_zones":["street_zone"],"has_clip":false,"has_snapshot":false},"type":"update"}}

I don’t know if you are already tried to exclude the Audio of the camera, sometimes this could be the problem.

You can disable the audio with this config:

input_args: -an

Setting args is a replacement for all the default args. It does not add to them. You almost certainly want to copy the default args and modify rather than replace them like this.

1 Like