blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.19k stars 1.75k forks source link

[Support]: MQTT Automation Behavior #7901

Closed divemasterjm closed 1 year ago

divemasterjm commented 1 year ago

Describe the problem you are having

in 0.13 beta 1, when in camera config zones are defined ha automation is not receiving new message. in mqttexplorer also new message isn't received but frigate event in frigate is ok.

Version

0.13 beta 1

Frigate config file

#yaml-language-server: $schema=http://192.168.8.68:5000/api/config/schema
#model:
  # Optional: path to the model (default: automatic based on detector)
#  path: /media/frigate/spaghettinet_edgetpu_l_compiled.tflite
#  labelmap_path: /labelmap.txt
#audio: # <- enable audio events for all camera
#  enabled: True
motion:
  # Optional: The threshold passed to cv2.threshold to determine if a pixel is different enough to be counted as motion. (default: shown below)
  # Increasing this value will make motion detection less sensitive and decreasing it will make motion detection more sensitive.
  # The value should be between 1 and 255.
  threshold: 30
  # Optional: Minimum size in pixels in the resized motion image that counts as motion (default: 30)
  # Increasing this value will prevent smaller areas of motion from being detected. Decreasing will
  # make motion detection more sensitive to smaller moving objects.
  # As a rule of thumb:
  #  - 15 - high sensitivity
  #  - 30 - medium sensitivity
  #  - 50 - low sensitivity
  contour_area: 10
  improve_contrast: true
  lightning_threshold: 0.8
#live:
  # Optional: Set the height of the live stream. (default: 720)
  # This must be less than or equal to the height of the detect stream. Lower resolutions
  # reduce bandwidth required for viewing the live stream. Width is computed to match known aspect ratio.
#  height: 640
  # Optional: Set the encode quality of the live stream (default: shown below)
  # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
#  quality: 8
snapshots:
  enabled: true
  timestamp: false
  bounding_box: false
  crop: false
  height: 500
  quality: 100
  retain:
    default: 10
    objects:
      person: 14
record:
  enabled: True
#  fps: 15
  retain:
    mode: all
  events:
    retain:
      mode: all
    pre_capture: 5
    post_capture:  10
detect:
#  width: 640
#  height: 360
  fps: 5
  # Optional: Configuration for stationary object tracking
  stationary:
    # Optional: Frequency for running detection on stationary objects (default: shown below)
    # When set to 0, object detection will never be run on stationary objects. If set to 10, 
    # it will be run on every 10th frame.
    interval: 150
    # Optional: Number of frames without a position change for an object to be considered 
    # stationary (default: 10x the frame rate or 10s)
    threshold: 150
    # Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
    # This can help with false positives for objects that should only be stationary for a limited amount of time.
    # It can also be used to disable stationary object tracking. For example, you may want to set a value for person,
    # but leave car at the default.
#    max_frames:
      # Optional: Default for all object types (default: not set, track forever)
#      default: 3000
      # Optional: Object specific values
#      objects:
#        person: 1000
#        car: 1000
objects:
  track:
    - person
    - bicycle
    - motorcycle
    - car
  filters:
    person:
      # Optional: minimum width*height of the bounding box for the detected object (default: 0)
      min_area: 1000
      # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
      max_area: 100000
      # Optional: minimum score for the object to initiate tracking (default: shown below)
      min_score: 0.6
      # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
      threshold: 0.7
      # Optional: mask to prevent this object type from being detected in certain areas (default: no mask)
      # Checks based on the bottom center of the bounding box of the object
#      mask: 0,0,1000,0,1000,200,0,200
    car:
      min_area: 1000
      min_score: 0.60
      threshold: 0.60
ffmpeg:
  hwaccel_args: preset-vaapi
#    - -hwaccel
#    - vaapi
#    - -hwaccel_device
#    - /dev/dri/renderD128
#    - -hwaccel_output_format
#    - yuv420p
#    - c:v h264_qsv    
#    - -hwaccel
#    - qsv
#    - -qsv_device
#    - /dev/dri/renderD128

#  hwaccel_args: -c:v h264_qsv
#  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt  -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -c:v h264_cuvid
#ffmpeg:
#  hwaccel_args:
#    - -hwaccel
#    - qsv
#    - -qsv_device
#    - /dev/dri/renderD128
#    - -c:v h264_qsv
  output_args:
    record: preset-record-generic-audio-aac
#ffmpeg:
#  hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
go2rtc:

  streams:
    garaje: rtsp://admin:1963jmlm@192.168.8.27/cam/realmonitor?channel=1&subtype=00
    garaje_sub: rtsp://admin:1963jmlm@192.168.8.27/cam/realmonitor?channel=1&subtype=01
    entradajardin: rtsp://admin:RGOVKT@192.168.8.239/Streaming/Channels/101
    entradajardin_sub: rtsp://admin:RGOVKT@192.168.8.239/Streaming/Channels/102
    piscina: rtsp://admin:L28B6647@192.168.8.72/cam/realmonitor?channel=1&subtype=00
    piscina_sub: rtsp://admin:L28B6647@192.168.8.72/cam/realmonitor?channel=1&subtype=01
    traserapiscina: rtsp://juanma:930133675@192.168.8.141:554/stream1
    traserapiscina_sub: rtsp://juanma:930133675@192.168.8.141:554/stream2
    trasera: rtsp://juanma:930133675@192.168.8.208:554/stream1
    trasera_sub: rtsp://juanma:930133675@192.168.8.208:554/stream2
    terraza: rtsp://admin:DRHPOK@192.168.8.138/Streaming/Channels/101
    terraza_sub: rtsp://admin:DRHPOK@192.168.8.138/Streaming/Channels/102
    salon2: rtsp://admin:L28C9F76@192.168.8.126:554/cam/realmonitor?channel=1&subtype=0
    salon2_sub: rtsp://admin:L28C9F76@192.168.8.126:554/cam/realmonitor?channel=1&subtype=1
    salon: rtsp://admin:L2E893D7@192.168.8.127:554/cam/realmonitor?channel=1&subtype=0
    salon_sub: rtsp://admin:L2E893D7@192.168.8.127:554/cam/realmonitor?channel=1&subtype=1
    cocina: rtsp://admin:L29F0749@192.168.8.122/cam/realmonitor?channel=1&subtype=00
    cocina_sub: rtsp://admin:L29F0749@192.168.8.122/cam/realmonitor?channel=1&subtype=01
    dormitorio: rtsp://admin:L2129A30@192.168.8.60:554/cam/realmonitor?channel=1&subtype=0
    dormitorio_sub: rtsp://admin:L2129A30@192.168.8.60:554/cam/realmonitor?channel=1&subtype=1
    pasillo: rtsp://admin:L2D30D80@192.168.8.99:554/cam/realmonitor?channel=1&subtype=0
    pasillo_sub: rtsp://admin:L2D30D80@192.168.8.99:554/cam/realmonitor?channel=1&subtype=1
    vestidor: rtsp://admin:admin@192.168.8.10/user=admin&password=admin&channel=1&stream=0.sdp?
    vestidor_sub: rtsp://admin:admin@192.168.8.10/user=admin&password=admin&channel=1&stream=1.sdp?

  webrtc:
    candidates:
      - 192.168.8.68:8555
      - stun:8555
detectors:
  coral1:
    type: edgetpu
    device: usb:0
  coral2:
    type: edgetpu
    device: usb:1
#  ov:
#    type: openvino
#    device: AUTO
#    model:
#      path: /openvino-model/ssdlite_mobilenet_v2.xml
#  coral2:
#    type: edgetpu
#    device: usb:1
database:
  path: /db/frigate.db
mqtt:
  host: 192.168.8.20
  user: mqttjuanma
  password: mqttjuanma

birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: True
  restream: True
  # Optional: Width of the output resolution (default: shown below)
  width: 640
  # Optional: Height of the output resolution (default: shown below)
  height: 360
  # 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: objects
ui:
  # Optional: Set the default live mode for cameras in the UI (default: shown below)
  live_mode: mse
  # Optional: Set a timezone to use in the UI (default: use browser local time)
  #timezone: None
  # Optional: Use an experimental recordings / camera view UI (default: shown below)
#  experimental_ui: True
cameras:
  garaje:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/garaje_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
        - path: rtsp://127.0.0.1:8554/garaje?video=copy&audio=aac 
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
#        - path: rtsp://127.0.0.1:8554/garaje_sub?audio
#          roles:
#            - audio
#    audio:
#      enabled: true
#      listen:
#        - bark
#        - scream
#        - speech
#        - yell
#        - car
#        - motorcylce
#        - traffic_noise
#        - motor_vehicle
    detect:
      width: 640
      height: 360
#      width: 2560
#      height: 1440
      fps: 15
 #     stationary:
  #      interval: 0
  #      threshold: 150
    motion:
#      mask:
#        - 199,575,244,807,85,816,46,609
#        - 60,206,0,217,29,261,93,279 
    zones:
      calle:
#        coordinates: 1920,0,1920,254,1832,248,1718,239,1557,141,1537,0
        coordinates:  640,0,640,136,540,98,475,76,467,0
#        coordinates:  640,0,640,101,507,92,505,0
        objects:
          - person
          - car
          - bicycle
          - motorcycle
        filters:
          person:
            min_score: 0.5
            threshold: 0.6
          car:
            min_score: 0.5
            threshold: 0.6
      coche:
#        coordinates: 0,0,1519,0,1525,147,1920,361,1920,1080,0,1080
        coordinates: 0,360,640,360,640,102,559,113,473,73,474,0,0,0
#        coordinates: 0,360,640,360,479,0,0,0
        objects:
#          - cat
          - person
        filters:
          person:
            min_score: 0.8
            threshold: 0.8
#            min_score: 0.77
#            threshold: 0.8
          car:
            min_score: 0.90
            threshold: 0.8

  #  objects:
    #  track:
     #   - person
#        - cat
     #   - car
     #   - bicycle
     #   - motorcycle
#      filters:
#          person:
#            min_score: 0.7
#            threshold: 0.7
#          car:
#            min_score: 0.6
#            threshold: 0.7
#      filters:
#        person:
      # Optional: minimum width*height of the bounding box for the detected object (default: 0)
 #         min_area: 5000
      # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
#          max_area: 100000
      # Optional: minimum score for the object to initiate tracking (default: shown below)
#          min_score: 0.74
    #    car:
     #     mask: 199,570,327,886,102,815,64,604 
#    rtmp:
#      enabled: True
    mqtt:
      height: 500
      # Optional: jpeg encode quality (default: shown below)
      quality: 99
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
#        required_zones:
#          - calle
#          - coche
#    snapshots:
#       required_zones:
#        - calle
#        - coche    
    live:
      stream_name: garaje_sub
    ui:
      order: 1
#    zones:
#      Coche:
#        coordinates: 1515,976
#      Entradagaraje:
#        coordinates: 1920,300
  entradajardin:
    enabled: True
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/entradajardin?video=copy&audio=aac
#        - path: rtsp://admin:RGOVKT@192.168.8.239/Streaming/Channels/101
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
        - path: rtsp://127.0.0.1:8554/entradajardin_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
    detect:
      width: 704
      height: 396
#      width: 1920
#      height: 1080
      fps: 5
    objects:
      track:
        - person
      filters:
        person:
          min_score: 0.75
          threshold: 0.7
    mqtt:
      height: 500
      # Optional: jpeg encode quality (default: shown below)
      quality: 99
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
    live:
      stream_name: entradajardin_sub
    ui:
      order: 2
  piscina:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/piscina_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
        - path: rtsp://127.0.0.1:8554/piscina?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
 #           - detect
    detect:
      width: 640
      height: 360
  #    width: 1920
   #   height: 1080
      fps: 5
    objects:
      track:
        - person
#        - cat
#        - bird
      filters:
        person:
          min_score: 0.75
          threshold: 0.7
    zones:
      agua:
#        coordinates: 400,407,1375,289,1587,747,53,808,0,675,203,450
        coordinates: 0,268,197,276,518,240,460,99,65,143
    mqtt:
      height: 500
      # Optional: jpeg encode quality (default: shown below)
      quality: 99
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
    live:
      stream_name: piscina_sub
    ui:
      order: 3
  traserapiscina:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:

        - path: rtsp://127.0.0.1:8554/traserapiscina_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
        - path: rtsp://127.0.0.1:8554/traserapiscina?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
    detect:
      width: 640
      height: 360
#      width: 1920
#      height: 1080
      fps: 5
    objects:
      track:
        - person
      filters:
        person:
          min_score: 0.75
          threshold: 0.7
    mqtt:
      height: 500
      # Optional: jpeg encode quality (default: shown below)
      quality: 99
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
    live:
      stream_name: traserapiscina_sub
    ui:
      order: 4
  terraza:
    enabled: true
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/terraza?video=copy&audio
#        - path: rtsp://admin:DRHPOK@192.168.8.138/Streaming/Channels/101
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
        - path: rtsp://127.0.0.1:8554/terraza_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
    detect:
      width: 704
      height: 396
#      width: 1920
#      height: 1080
      fps: 5
    objects:
      track:
        - person
      filters:
        person:
          min_score: 0.75
          threshold: 0.7
    mqtt:
      height: 500
      # Optional: jpeg encode quality (default: shown below)
      quality: 99
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
    live:
      stream_name: terraza_sub
    ui:
      order: 5
  trasera:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/trasera_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
        - path: rtsp://127.0.0.1:8554/trasera?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
    detect:
      width: 640
      height: 360
#      width: 1920
#      height: 1080
      fps: 5
    objects:
      track:
        - person
      filters:
        person:
          min_score: 0.75
          threshold: 0.7
    mqtt:
      height: 500
      # Optional: jpeg encode quality (default: shown below)
      quality: 99
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
    live:
      stream_name: trasera_sub
    ui:
      order: 6
  salon2:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy 
      inputs:
        - path: rtsp://127.0.0.1:8554/salon2?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
        - path: rtsp://127.0.0.1:8554/salon2_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
    detect:
      width: 640
      height: 360
#      width: 1280
#      height: 720
      fps: 5
    objects:
      track:
        - person
    mqtt:
      height: 500
      # Optional: jpeg encode quality (default: shown below)
      quality: 99
    live:
      stream_name: salon2_sub
    ui:
      order: 7
  salon:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/salon?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
        - path: rtsp://127.0.0.1:8554/salon_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
    motion:
      mask:
        - 380,36,386,114,268,121,265,50
    detect:
      width: 640
      height: 360
#      width: 1280
#      height: 720
      fps: 5
    objects:
      track:
        - person
    mqtt:
      height: 500
      quality: 99
    live:
      stream_name: salon_sub
    ui:
      order: 8
  cocina:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/cocina?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
        - path: rtsp://127.0.0.1:8554/cocina_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
    detect:
      width: 640
      height: 360
#      width: 1280
#      height: 720
      fps: 5
    objects:
      track:
        - person
    mqtt:
      height: 500
      quality: 99
    live:
      stream_name: cocina_sub
    ui:
      order: 9
  pasillo:
#    audio:
#      enabled: true
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/pasillo?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
        - path: rtsp://127.0.0.1:8554/pasillo_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#        - path: rtsp://127.0.0.1:8554/pasillo?audio
#          roles:
#            - audio
#            - audio
    record:
      retain:
        days: 10
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
    detect:
      width: 640
      height: 360
#      width: 1280
#      height: 720
      fps: 5
    objects:
      track:
        - person
    mqtt:
      height: 500
      quality: 99
    live:
      stream_name: pasillo_sub
    ui:
      order: 10

  vestidor:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/vestidor?video=copy&audio=aac
#         - path: rtsp://192.168.8.51/ch0_0.h264
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
#         - path: rtsp://192.168.8.51/ch0_1.h264
        - path: rtsp://127.0.0.1:8554/vestidor_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record         
    detect:
      width: 640
      height: 360
#      width: 1920
#      height: 1080
      fps: 15
    record:
      enabled: True
      retain:
        days: 10
        mode: all  
      events:
        retain:
          default: 14
          mode: active_objects
    objects:
      track:
        - person
    mqtt:
      height: 500
      # Optional: jpeg encode quality (default: shown below)
      quality: 99
    live:
      stream_name: vestidor_sub
    ui:
      order: 11
  dormitorio:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/dormitorio_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
#            - audio
        - path: rtsp://127.0.0.1:8554/dormitorio?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
    detect:
      width: 640
      height: 360
#      width: 1920
#      height: 1080
      fps: 15
    record:
      enabled: True
      retain:
        days: 10
        mode: all 
      events:
        retain:
          default: 14
          mode: active_objects
    objects:
      track:
        - person
    mqtt:
      height: 500
      # Optional: jpeg encode quality (default: shown below)
      quality: 99
    live:
      stream_name: dormitorio_sub
    ui:
      order: 12
#    birdseye:
#      enabled: False

Relevant log output

{
  "before": {
    "id": "1695301474.932889-e8l7yf",
    "camera": "garaje",
    "frame_time": 1695301474.932889,
    "snapshot": null,
    "id": "1695301491.018483-r54d77",
    "camera": "entradajardin",
    "frame_time": 1695301491.223303,
    "snapshot": {
      "frame_time": 1695301491.223303,
      "box": [
        576,
        66,
        669,
        330
      ],
      "area": 24552,
      "region": [
        388,
        53,
        704,
        369
      ],
      "score": 0.82421875,
      "attributes": []
    },
    "label": "person",
    "sub_label": null,
    "top_score": 0,
    "false_positive": true,
    "start_time": 1695301474.932889,
    "top_score": 0.8125,
    "false_positive": false,
    "start_time": 1695301491.018483,
    "end_time": null,
    "score": 0.6640625,
    "score": 0.82421875,
    "box": [
      3,
      161,
      144,
      317
      576,
      66,
      669,
      330
    ],
    "area": 21996,
    "ratio": 0.9038461538461539,
    "area": 24552,
    "ratio": 0.3522727272727273,
    "region": [
      0,
      160,
      160,
      320
      388,
      53,
      704,
      369
    ],
    "stationary": false,
    "motionless_count": 0,
    "position_changes": 0,
    "position_changes": 1,
    "current_zones": [],
    "entered_zones": [],
    "has_clip": false,
    "has_snapshot": false,
    "has_clip": true,
    "has_snapshot": true,
    "attributes": {},
    "current_attributes": []
  },
  "after": {
    "id": "1695301474.932889-e8l7yf",
    "camera": "garaje",
    "frame_time": 1695301475.806357,
    "id": "1695301491.018483-r54d77",
    "camera": "entradajardin",
    "frame_time": 1695301492.547024,
    "snapshot": {
      "frame_time": 1695301475.806357,
      "frame_time": 1695301491.223303,
      "box": [
        11,
        130,
        101,
        327
        576,
        66,
        669,
        330
      ],
      "area": 17730,
      "area": 24552,
      "region": [
        0,
        28,
        332,
        360
        388,
        53,
        704,
        369
      ],
      "score": 0.796875,
      "score": 0.82421875,
      "attributes": []
    },
    "label": "person",
    "sub_label": null,
    "top_score": 0.71484375,
    "top_score": 0.822265625,
    "false_positive": false,
    "start_time": 1695301474.932889,
    "end_time": null,
    "score": 0.796875,
    "start_time": 1695301491.018483,
    "end_time": 1695301494.559497,
    "score": 0.8046875,
    "box": [
      11,
      130,
      101,
      327
      547,
      75,
      626,
      237
    ],
    "area": 17730,
    "ratio": 0.45685279187817257,
    "area": 12798,
    "ratio": 0.4876543209876543,
    "region": [
      0,
      28,
      332,
      360
      480,
      49,
      692,
      261
    ],
    "stationary": false,
    "motionless_count": 12,
    "motionless_count": 0,
    "position_changes": 1,
    "current_zones": [],
    "entered_zones": [],
    "has_clip": true,
    "has_snapshot": true,
    "attributes": {},
    "current_attributes": []
  },
  "type": "new"
  "type": "end"
}

FFprobe output from your camera

[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"15/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":360,"width":640},{"avg_frame_rate":"0/0","codec_long_name":"AAC(AdvancedAudioCoding)"}]}},{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"0/0","codec_long_name":"AAC(AdvancedAudioCoding)"},{"avg_frame_rate":"15/1","codec_long_name":"H.265/HEVC(HighEfficiencyVideoCoding)","height":1440,"width":2560}]}}]

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

dahua

Any other information that may be helpful

ha automation

alias: evento frigate calle description: "" trigger:

NickM-27 commented 1 year ago

Right, most likely in this case the object is being detected earlier and the new message does not have any zones in the after part.

I'd suggest removing the new condition and adding a this condition

condition: template
value_template: >-
{{ ["calle"]|select("in",
trigger.payload_json["before"]["entered_zones"])|list|length == 0 }}
enabled: true
divemasterjm commented 1 year ago

Right, most likely in this case the object is being detected earlier and the new message does not have any zones in the after part.

I'd suggest removing the new condition and adding a this condition

condition: template
value_template: >-
{{ ["calle"]|select("in",
trigger.payload_json["before"]["entered_zones"])|list|length == 0 }}
enabled: true

so i delete the new condition and leave only

condition: template value_template: >- {{ ["calle"]|select("in",trigger.payload_json["before"]["entered_zones"])|list|length == 0 }}

in this case it will fire also on update, so i will get more fired automations

NickM-27 commented 1 year ago

so i delete the new condition and leave only

check what I said, I am suggesting you have 2 conditions

- condition: template
value_template: >-
{{ ["calle"]|select("in",
trigger.payload_json["before"]["entered_zones"])|list|length == 0 }}
enabled: true
- condition: template
value_template: >-
{{ ["calle"]|select("in",
trigger.payload_json["after"]["entered_zones"])|list|length > 0 }}
enabled: true

in this case it will fire also on update, so i will get more fired automations

no, you won't. entered_zones is a list of all the zones the object has ever entered. By checking that the before.entered_zones is empty and after.entered_zones has your zone you are ensuring that you only get notified the first time the object is considered inside the zone

divemasterjm commented 1 year ago

{{ ["calle"]|select("in", trigger.payload_json["before"]["entered_zones"])|list|length == 0 }}

i tried and i've got 2 messages.

NickM-27 commented 1 year ago

Did you include the second condition too?

divemasterjm commented 1 year ago

Did you include the second condition too?

yes

NickM-27 commented 1 year ago

Then most likely it was two different objects that were detected. You can get the MQTT payloads from the automation trace in HA ui

divemasterjm commented 1 year ago

Then most likely it was two different objects that were detected. You can get the MQTT payloads from the automation trace in HA ui

if i add {{ trigger.payload_json['type'] != 'update'}} then i have only one

NickM-27 commented 1 year ago

Different things can happen each time, it's best to use the traces to understand what exactly happened and change the automation.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.