SgtBatten / HA_blueprints

Somewhere to store automation blueprints
181 stars 69 forks source link

[Config Support]: #104

Closed francoisduprez closed 11 months ago

francoisduprez commented 11 months ago

Describe the problem you are having or the outcome you are trying to achieve.

I'm trying to get face detection from doubletake into Frigate Notifications 0.12.0.1r , but don't understand how. In the README.md i read Replace {{label}} in title and message of the notification with a persons name if double-take face match is detected. But tried different combinations without luck. How can i put multiple faces in??

It will print the name i put in, even when unknown or an other person is detected..

Version

0.12.0.1r

Automation config file

alias: Detectie_tuinpoort_francois
description: ""
use_blueprint:
  path: SgtBatten/Beta.yaml
  input:
    camera: camera.tuinpoort
    notify_device: cef0e544c5ae21a1ae4a2ea4b9ae49bc
    message: "{{label}} is gedetecteerd op camera {{camera_name}} "
    video: >-
      {{base_url}}/api/frigate{{client_id}}/notifications/{{id}}/{{camera}}/clip.mp4
    attachment: snapshot.jpg?bbox=1
    critical: "false"
    zone_filter: true
    zones:
      - poort_stoep
    labels: []
    base_url: https://home.mirmooi.net/
    silence_timer: 0
    cooldown: 0
    zone_multi: false
    icon: mdi:cctv
    title: francois
    subtitle: "francois is gedetecteerd op camera {{camera_name}} "

Frigate Config

mqtt:
  host: 192.168.1.44
  topic_prefix: frigate
  user: 
  password: 

database:
  path: /config/frigate.db

environment_vars:
  VARIABLE_NAME: LIBVA_DRIVER_NAME=i965

detectors:
 # coral1:
 #   type: edgetpu
 #   device: pci:0
  coral2:
    type: edgetpu
    device: pci:1

go2rtc:
  streams:
    voordeur:
      - "ffmpeg:http://192.168.1.7/flv?port=1935&app=bcs&stream=channel0_main.bcs&user={FRIGATE_USER}&password={FRIGATE_RTSP_PASSWORD}#video=copy#audio=copy#audio=opus"
    voordeur_sub:
      - "ffmpeg:http://192.168.1.7/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user={FRIGATE_USER}&password={FRIGATE_RTSP_PASSWORD}"
    tuinpoort:
      - "ffmpeg:http://192.168.1.8/flv?port=1935&app=bcs&stream=channel0_main.bcs&user={FRIGATE_USER}&password={FRIGATE_RTSP_PASSWORD}#video=copy#audio=copy#audio=opus"
    tuinpoort_sub:
      - "ffmpeg:http://192.168.1.8/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user={FRIGATE_USER}&password={FRIGATE_RTSP_PASSWORD}"
    tuin:
      - "ffmpeg:http://192.168.1.12/flv?port=1935&app=bcs&stream=channel0_main.bcs&user={FRIGATE_USER}&password={FRIGATE_RTSP_PASSWORD}#video=copy#audio=copy#audio=opus"
    tuin_sub:
      - "ffmpeg:http://192.168.1.12/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user={FRIGATE_USER}&password={FRIGATE_RTSP_PASSWORD}"
    aquarium:
      - "ffmpeg:rtsp://192.168.1.42:8554/cam"
#    bodem_cam:
#      - "ffmpeg:rtsp://192.168.1.42:8554/usbcam"

cameras:
  voordeur:
    enabled: True
    ffmpeg:
      output_args:
          record: preset-record-generic-audio-copy
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://127.0.0.1:8554/voordeur
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/voordeur_sub
          input_args: preset-rtsp-restream
          roles:
            - detect
    detect:
      width: 640
      height: 480
      fps: 5
    objects:
      track:
        - person
      filters:
        person:
          threshold: 0.74
    snapshots:
      enabled: true
      required_zones:
        - voordeur_stoep
      retain:
        default: 14
    record:
      enabled: true
      retain:
       days: 5
      events:
       retain:
        default: 30
       required_zones:
          - voordeur_stoep
    zones:
      voordeur_stoep:
        coordinates: 171,480,415,480,279,284,108,348
    motion:
      mask:
        - 640,0,640,430,294,102,299,0
    birdseye:
     enabled: True
     quality: 5
     mode: continuous
    ui:
      order: 1

  tuinpoort:
    enabled: True
    ffmpeg:
      output_args:
            record: preset-record-generic-audio-copy
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://127.0.0.1:8554/tuinpoort
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/tuinpoort_sub
          input_args: preset-rtsp-restream
          roles:
           - detect
    detect:
      width: 640
      height: 480
      fps: 5
    objects:
      track:
        - person
        - dog
        - cat
        - bicycle
        - motorcycle
      filters:
        person:
         threshold: 0.74
        dog:
          threshold: 0.8
        cat:
          threshold: 0.8
        bicycle:
          threshold: 0.7
        motorcycle:
          threshold: 0.7
    snapshots:
      enabled: true
      required_zones:
        - poort_stoep
      timestamp: false
      bounding_box: true
      retain:
        default: 14
    record:
      enabled: True
      retain:
        days: 5
      events:
        retain:
          default: 14
        required_zones:
          - poort_stoep
    zones:
        poort_stoep:
         coordinates: 286,333,491,480,273,480,194,369
        poort_steeg:
         coordinates: 598,75,585,135,475,109,467,76
    motion:
     mask:
      - 172,0,157,480,0,480,0,0
      - 640,0,640,71,597,68,595,0
    birdseye:
     enabled: True
     quality: 5
     mode: continuous
    ui:
      order: 2

  tuin:
    enabled: True
    ffmpeg:
      output_args:
            record: preset-record-generic-audio-copy
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://127.0.0.1:8554/tuin
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/tuin_sub
          input_args: preset-rtsp-restream
          roles:
            - detect
    detect:
      width: 640
      height: 480
      fps: 5
    birdseye:
     enabled: True
     quality: 5
     mode: continuous
    ui:
      order: 3

  aquarium:
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/aquarium
          roles:
            - record
    ui:
      order: 4

  bodem_cam:
    enabled: true
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.42:8554/usbcam
#        - path: rtsp://127.0.0.1:8554/Bodem_cam
          roles:
            - record
    ui:
      order: 5

Any other information that may be helpful

No response

SgtBatten commented 11 months ago

It should still be {{label}} in the automation.

You just need to configure double take to pass the sublabel to frigate.

There are two lines you need in double take config, search the closed issues and you should find them.

francoisduprez commented 11 months ago

If i found the lines (i think)

update_sub_labels: true stop_on_match: true

But i get errors, and i'm to noob to understand what to do with them. Hope you can help me a little bit closer at a solution.

23-10-10 23:19:33 verbose: api listening on :3000 23-10-10 23:19:33 info: MQTT: connected 23-10-10 23:19:33 info: MQTT: subscribed to frigate/events, frigate/voordeur/person/snapshot, frigate/tuinpoort/person/snapshot 23-10-10 23:20:03 verbose: Incoming event from frigate: {"before": {"id": "1696972801.58848-ul6qyt", "camera": "voordeur", "frame_time": 1696972801.58848, "snapshot": null, "label": "person", "sub_label": null, "top_score": 0.0, "false_positive": true, "start_time": 1696972801.58848, "end_time": null, "score": 0.6171875, "box": [0, 135, 291, 456], "area": 93411, "ratio": 0.9065420560747663, "region": [0, 56, 424, 480], "stationary": false, "motionless_count": 0, "position_changes": 0, "current_zones": [], "entered_zones": [], "has_clip": false, "has_snapshot": false, "attributes": {}, "current_attributes": []}, "after": {"id": "1696972801.58848-ul6qyt", "camera": "voordeur", "frame_time": 1696972803.575137, "snapshot": {"frame_time": 1696972803.575137, "box": [142, 94, 416, 472], "area": 103572, "region": [0, 0, 724, 724], "score": 0.84375, "attributes": []}, "label": "person", "sub_label": null, "top_score": 0.82421875, "false_positive": false, "start_time": 1696972801.58848, "end_time": null, "score": 0.84375, "box": [142, 94, 416, 472], "area": 103572, "ratio": 0.7248677248677249, "region": [0, 0, 724, 724], "stationary": false, "motionless_count": 5, "position_changes": 1, "current_zones": ["voordeur_stoep"], "entered_zones": ["voordeur_stoep"], "has_clip": true, "has_snapshot": true, "attributes": {}, "current_attributes": []}, "type": "new"} 23-10-10 23:20:03 info: processing voordeur: 1696972801.58848-ul6qyt 23-10-10 23:20:04 info: done processing voordeur: 1696972801.58848-ul6qyt in 0.5 sec 23-10-10 23:20:04 info: { id: '1696972801.58848-ul6qyt', duration: 0.5, timestamp: '2023-10-10T21:20:04.377Z', attempts: 2, camera: 'voordeur', zones: [ 'voordeur_stoep' ], counts: { person: 1, match: 1, miss: 0, unknown: 0 }, matches: [ { name: 'postbode', confidence: 76.29, match: true, box: [Object], type: 'latest', duration: 0.44, detector: 'aiserver', filename: '0609203d-56fb-49f7-affe-4809970c87fe.jpg' } ], misses: [], unknowns: [] } 23-10-10 23:20:04 error: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at new NodeError (node:internal/errors:387:5) at ServerResponse.setHeader (node:_http_outgoing:644:11) at ServerResponse.header (/double-take/api/node_modules/express/lib/response.js:794:10) at ServerResponse.send (/double-take/api/node_modules/express/lib/response.js:174:12) at ServerResponse.res.send (/double-take/api/src/middlewares/respond.js:41:18) at ServerResponse.json (/double-take/api/node_modules/express/lib/response.js:278:15) at ServerResponse.send (/double-take/api/node_modules/express/lib/response.js:162:21) at ServerResponse.res.send (/double-take/api/src/middlewares/respond.js:41:18) at /double-take/api/src/app.js:46:38 at newFn (/double-take/api/node_modules/express-async-errors/index.js:16:20)

SgtBatten commented 11 months ago

Sorry I'm no expert on it either.

You have those parameters on seperate lines I assume?

I don't think that error is explicitly related.

francoisduprez commented 11 months ago

Thanks for your reaction,

The problem is at Double Take. I've downgraded to Double Take 1.13.10 and all the problems where gone.. The only thing i have now, is that at detection, i get "['francois', None] is gedetecteerd."

But i didn't look further in this problem...

SgtBatten commented 11 months ago

That is a new update from frigate I need to address. I will try to get to it soon.

francoisduprez commented 11 months ago

It works great for me, so no complains here... Keep up the good work..

Thanks.