Local realtime person detection for RTSP cameras

Here are my kinda hackey work arounds to multiple notifications. Basically, the automation needs 5min without an object detected before it will send a notification. In theory, for a car sitting in the driveway you would get one notification on first detection and then no more until there was no car for 5min.

It wouldn’t tell you if another car showed up. Not sure if frigate reports the number of detected objects or not. If it did I guess it’d be possible to add that logic. There might be more sophisticated ways to do this by event type. Instead of timer maybe just ignore any events that are “type : update”. Its possible that’d detect a new car in the scene? not sure…

alias: Frigate Car Notification
description: ''
trigger:
  - platform: mqtt
    topic: frigate/events
condition:
  - condition: state
    entity_id: binary_sensor.front_car_motion
    state: 'off'
    for: '00:05:00'
  - condition: and
    conditions:
      - condition: template
        value_template: '{{trigger.payload_json["after"]["label"] == "car"}}'
action:
  - service: notify.mobile_app_XXXXX_iphone
    data:
      message: 'A {{trigger.payload_json["after"]["label"]}} was detected.'
      data:
        attachment:
          url: >-
            https://XXXXXXXXXXX.ui.nabu.casa/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android
          hide-thumbnail: false
        apns_headers:
          apns-collapse-id: '{{trigger.payload_json["after"]["id"]}}'
mode: single
alias: Frigate Person Notification
description: ''
trigger:
  - platform: mqtt
    topic: frigate/events
condition:
  - condition: state
    entity_id: binary_sensor.front_person_motion
    state: 'off'
    for: '00:05:00'
  - condition: and
    conditions:
      - condition: template
        value_template: '{{trigger.payload_json["after"]["label"] == "person"}}'
action:
  - service: notify.mobile_app_XXXXXX_iphone
    data:
      message: 'A {{trigger.payload_json["after"]["label"]}} was detected.'
      data:
        attachment:
          url: >-
            https://XXXXXXXXXXXXXXX.ui.nabu.casa/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android
          hide-thumbnail: false
        apns_headers:
          apns-collapse-id: '{{trigger.payload_json["after"]["id"]}}'
mode: single

1 Like