SgtBatten / HA_blueprints

Somewhere to store automation blueprints
184 stars 71 forks source link

[Config Support]: Inconsistent clip updates. #209

Closed WolfeCub closed 4 months ago

WolfeCub commented 4 months ago

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

Clips usually don't seem to update/display in the notification. Occasionally they'll work but I mostly just see the snapshot.

Before using this blueprint I had my own automation that featured a 10 second delay and there were no issues. I noticed the beta version docs say there's a 10 second delay before the final message however looking at the code/traces link here it seems to only be 5 seconds? Would it be possible to make this configurable?

I suspect the delay is the problem but not 100% sure. Let me know if there's anything else I should try.

Version

0.12.0.3c

Automation config

alias: Frigate Driveway Notification
description: ""
use_blueprint:
  path: SgtBatten/Beta.yaml
  input:
    camera: camera.frigate_driveway
    notify_group: all_phones
    base_url: <my_base_url>
    video: >-
      {{base_url}}/api/frigate{{client_id}}/notifications/{{id}}/{{camera}}/clip.mp4
    notify_device: <some_device>
    attachment: snapshot.jpg?bbox=1&crop=1
    update_thumbnail: true
    message: >-
      {{ label }} detected - {{ camera_name }} at
      {{event['after']['start_time']|timestamp_custom('%H:%M')}}
    alert_once: true
    zones:
      - driveway
    zone_filter: true
    cooldown: 0

Frigate Config

mqtt:
  host: <mqtt_host>
  port: 1883

database:
  path: /data/frigate.db

go2rtc:
  streams:
    backdoor: rtsp://<camera>/Preview_01_main
    driveway: rtsp://<camera/Preview_01_main

detectors:
  coral:
    type: edgetpu
    device: usb

motion:
  mask:
    - 3830,59,3836,15,3092,14,3095,65 # Timestamp

objects:
  filters:
    person:
      min_area: 34000

cameras:
  frigate_backdoor:
    ffmpeg:
      inputs:
        - path: rtsp://localhost:8554/backdoor
      hwaccel_args: preset-vaapi
    detect:
      enabled: True
  frigate_driveway:
    ffmpeg:
      inputs:
        - path: rtsp://localhost:8554/driveway
      hwaccel_args: preset-vaapi
    detect:
      enabled: True
    record:
      events:
        required_zones:
          - driveway
    snapshots:
      required_zones:
        - driveway
    zones:
      driveway:
        coordinates: 0,2160,3840,2160,3840,214,2538,118,2482,267,1491,274,0,571

record:
  enabled: True
  retain:
    days: 0
    mode: all
  events:
    retain:
      default: 30
      mode: active_objects

snapshots:
  enabled: True
  crop: True

birdseye:
  enabled: True
  mode: continuous

Any other information that may be helpful

No response

WolfeCub commented 4 months ago

Just to further confirm my theory I tested a fork https://github.com/WolfeCub/HA_blueprints/commit/ffd0646c9fb44fe4b5fe3ee73ce86ec3e4d67875 where I upped the delay to 10 seconds and the clips started working consistently. Ideally this would be a user configurable parameter. Would you be open to me making a PR?

SgtBatten commented 4 months ago

Would you be open to me making a PR?

Yes please make one to the stable branch. Beta branch has jsut been merged into it and i plan to update it for new version of frigate, Once that happens and i ultimately forget to add this into the beta, please make another one for that. Thank you so much