SgtBatten / HA_blueprints

Somewhere to store automation blueprints
184 stars 71 forks source link

[Issue]: Getting push notifications in a loop #197

Closed Beeez closed 4 months ago

Beeez commented 5 months ago

Description

I am getting a constant loop of the same push notification and image and its driving me insane and I cannot figure out what keeps triggering this, or how to have it stop. Typically I will be fine for awhile, then almost randomly I will get one notification, then it wont stop. If i dismiss the notification, it comes back shortly after.

This trace is currently at 265 iterations. image

I can provide a full trace dump if that is helpful as well.

Version

0.12.0.2

Automation Config

alias: New Front Door Notification
description: ""
use_blueprint:
  path: SgtBatten/Stable.yaml
  input:
    camera: camera.front_door
    ios_live_view: false
    zone_filter: true
    zones:
      - driveway
      - frontgrass
      - porch
    notify_device: 72e278a0ebcd4ae542504a418cfcca42
    debug: true
    state_filter: true
    state_entity: input_boolean.notify_for_people_on_camera
    state_filter_states:
      - "On"
    alert_once: true
    tv_interrupt: false

Frigate Config

mqtt:
  host: 192.168.4.31
  port: 1883
  user: mqttuser
  password: 'XXXXXXXXXXXX'
  topic_prefix: frigate

database:
  path: /config/frigate.db

# Optional: birdseye configuration
birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: True
  # Optional: Width of the output resolution (default: shown below)
  width: 1280
  # Optional: Height of the output resolution (default: shown below)
  height: 720
  # Optional: Encoding quality of the mpeg1 feed (default: shown below)
  # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
  quality: 8
  # Optional: Mode of the view. Available options are: objects, motion, and continuous
  #   objects - cameras are included if they have had a tracked object within the last 30 seconds
  #   motion - cameras are included if motion was detected in the last 30 seconds
  #   continuous - all cameras are included always
  mode: continuous

#ui:
#  use_experimental: true

ffmpeg:
  hwaccel_args: preset-vaapi
  input_args: preset-rtsp-restream
  output_args:
    record: preset-record-generic

go2rtc:
  streams:
    front_door:
      - ffmpeg:http://192.168.4.45/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=XXXXXXXXXXX
    front_door_sub:
      - ffmpeg:http://192.168.4.45/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=XXXXXXXXXXX
    garage_inside:
      - ffmpeg:http://192.168.4.50/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=XXXXXXXXXXX
    garage_inside_sub:
      - ffmpeg:http://192.168.4.50/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=XXXXXXXXXXX
    front_driveway:
      - ffmpeg:http://192.168.4.32/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=XXXXXXXXXXX
    front_driveway_sub:
      - ffmpeg:http://192.168.4.32/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=XXXXXXXXXXX
    back_yard:
      - ffmpeg:http://192.168.4.71/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=XXXXXXXXXXX
    back_yard_sub:
      - ffmpeg:http://192.168.4.71/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=XXXXXXXXXXX
    #indoors:
    #  - ffmpeg:http://192.168.4.79/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=XXXXXXXXXXX
    #indoors_sub:
    #  - ffmpeg:http://192.168.4.79/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=XXXXXXXXXXX

cameras:
  front_door:
    objects:
      track:
        - person
        - car
      filters:
        person:
          min_area: 10000
          min_score: 0.65
          mask:
          - 583,378,462,489,458,606,660,720,336,720,313,596,345,489,394,425,446,368
          - 472,67,552,93,378,177,313,135
        car:
          min_area: 10000
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/front_door
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/front_door_sub
          roles:
            - detect
    detect:
      width: 1280
      height: 720
      fps: 5
    motion:
      mask:
        - 925,32,908,0,799,0,763,81,841,113,913,82
        - 348,183,0,313,0,80,0,0,264,0,886,0
        - 583,378,462,489,458,606,660,720,336,720,313,596,345,489,394,425,446,368
        - 1238,21,1234,71,638,63,634,22
    zones:
      driveway:
        coordinates: 269,211,424,200,251,345,65,308
        objects:
          - person
          - car
      driveway_parked:
        coordinates: 291,352,970,395,995,157,865,105,784,96,605,93,478,131,379,179,356,208,265,304,239,333
        objects:
          - person
      porch:
        coordinates: 831,207,984,38,1174,54,1059,720,987,720,652,720,499,649,448,523,602,361
        objects:
          - person
      frontgrass:
        coordinates: 186,328,438,363,357,484,337,720,0,720,0,383,86,323
        objects:
          - person
  garage_inside:
    objects:
      track:
        - person
        - car
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/garage_inside
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/garage_inside_sub
          roles:
            - detect
    detect:
      width: 1280
      height: 720
      fps: 5
    motion:
      mask:
        - 620,657,621,690,22,693,22,652
    zones:
      garage_spot:
        coordinates: 570,131,924,418,940,503,826,720,367,720,22,245
        objects:
          - car
          - person
      parked:
        coordinates: 1055,720,1029,536,692,720
        objects:
          - car
  front_driveway:
    objects:
      filters:
        car:
          mask:
          - 1280,0,1280,264,993,169,390,49,0,130,0,0
        person:
          mask:
          - 1280,0,1280,264,993,169,390,49,0,130,0,0
          min_score: 0.71
          max_area: 100000
          min_area: 1100
      track:
        - person
        - car
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/front_driveway
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/front_driveway_sub
          roles:
            - detect
    motion:
      mask:
        - 21,59,619,62,620,23,23,24
    zones:
      front_driveway_center:
        coordinates: 0,464,447,273,359,148,636,91,778,112,1280,264,1280,476,944,720,0,720
        objects:
          - car
          - person
    detect:
      width: 1280
      height: 720
      fps: 5
  back_yard:
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          mask:
            - 1280,720,1044,720,1114,468,1280,468
            - 1280,0,1280,149,798,85,376,164,0,251,0,0,1041,0
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/back_yard
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/back_yard_sub
          roles:
            - detect
    motion:
      mask:
        - 625,24,628,56,22,63,21,25
    zones:
      backgrass:
        coordinates: 1074,247,915,399,1280,481,1280,185,1280,98,1198,91,1056,32,857,31,854,77,769,79,695,66,462,148
        objects:
          - person
          - dog
          - cat
      porch_grass:
        coordinates: 255,148,322,47,434,44,479,141,1083,204,1030,405,1280,720,0,720,0,202
        objects:
          - person
          - dog
          - cat
    detect:
      width: 1280
      height: 720
      fps: 5

snapshots:
  enabled: true
  bounding_box: true
  required_zones:
    - driveway
    - porch
    - backgrass
    - frontgrasss
    - front_driveway_center
    - porch_grass
    - garage_spot
  retain:
    default: 3

detectors:
  cpu1:
    type: cpu

record:
  enabled: True
  retain:
    days: 15
    mode: all
  events:
    required_zones:
      - driveway
      - porch
      - garage_spot
      - backgrass
      - frontgrass
      - porch_grass
      - front_driveway_center
    retain:
      default: 20
      mode: active_objects
    pre_capture: 5
    post_capture: 20

timestamp_style:
  position: "tr"
  format: "%m/%d/%Y %H:%M:%S"

Any other relevant information

Frigate Notification DEBUG (in loop): Info: Last Zones: ['driveway'], Current zones: ['driveway'], sublabel: None, iOS sound: True, Android Sound: disabled by alert once, Triggers: New Snapshot: False, Presence Changed: False, stationary moved: True, entered zones changed: False, sublabel changed: False, Conditions: Loitering: 0 or Presence Entity not home: OFF - PASS, zone filter TEST: ON - PASS, multi-zone filter: OFF - PASS, state filter TEST: ON - PASS image: "/api/frigate/notifications/1712689852.491075-h92vus/thumbnail.jpg" triggered by automation New Front Door Notification mqtt topic frigate/events
SgtBatten commented 5 months ago

I assume its of a car? Wherever that car is, make it not in a zone for cars. Or stop tracking stationary objects. Frigate has some guidance on avoiding stationary objects in the docs.

Beeez commented 5 months ago

Correct, it is a car. The odd thing is, is that in the loop that keeps notifying, there isn't a car in that zone. The blueprint only has driveway, frontgrass, and porch as the zones. and the car that being detected and notified about in a loop isn't in the "driveway" zone, the car is in my "driveway_parked" zone

image

image

image

SgtBatten commented 5 months ago

You must have an ongoing event from when it arrived. I suggest looking at the stationary objects content in the frigate guides and avoid tracking cars all the time https://docs.frigate.video/guides/parked_cars

Beeez commented 5 months ago

Yeah I have gone through that in the past and have a split zone like was shown in the example photo on the page.

The car is currently in the driveway_parked zone, and in the Blueprints configuration I only have driveway as the required zone. I would think that would then mean the notification should only trigger once the car is in the driveway zone?

Wouldn't the event "end" once that object is no longer in the zone? The car arrives, goes through the driveway zone, then sits stationary in the driveway_parked zone. So I'm not sure why an event would still be ongoing after it arrives?

image

SgtBatten commented 5 months ago

The event is absolutely still ongoing, hence the notifications.

I would think that disabling static object tracking would be one solution but You could create an object mask just for cars such that frigate can't see cars in that area, but can see anything else.

I've done a lot of work with zones in the beta version so perhaps trying that does have an impact, but I'm not sure.

Beeez commented 5 months ago

Thanks, I will see if making an object mask around the spot where the car is currently parked fixes it.