SgtBatten / HA_blueprints

Somewhere to store automation blueprints
207 stars 80 forks source link

Notifications to Home Assistant app do not allow clips to be viewed on iOS devices on local LAN #128

Open pbix opened 11 months ago

pbix commented 11 months ago

Description

I am using Frigate Notification 0.12.0.2 and I also have a NabuCasa subscription. The camera notifications arrive reliably as do the snapshots of events on my cameras to my phone. However, I cannot get the clips to play when my phone is on the local LAN. If I turn off my Wifi and just use my 5G connection then I can view these clips.

Other things I have observed. If I copy past the URL into Safari the clip works in both modes. An example clip I get in the notification https://2lykg5dvv9pzqucszrqhpxl0dd7.ui.nabu.casa/api/frigate/notifications/1701043514.514947-43q190/garagecam/clip.mp4?external_auth=1

I deleted a section of the URL so no it will not work for you but this is an example of what one gets in the notification.

I cannot understand why this will not work when I am on the local LAN with the Frigate system but it does work when I am remote. Also, I cannot understand why this same URL works fine in Safari in both environments.

Willing to provide more debugging if it could help but I am at a loss as to what to look for.

Version

0.12.0.1

Automation Config

alias: Person in Garage
description: Someone is in the garage
use_blueprint:
  path: SgtBatten/Stable.yaml
  input:
    camera: camera.garagecam
    update_thumbnail: true
    ios_live_view: true
    notify_device: 210a8e78b18c3589571f90a0de119014

Frigate Config

#
#Bounding box colors.
#  Red - Motion
#  Yellow - Person
#  Blue - Car

mqtt:
  host: 192.168.2.190
  user: xxxx
  password: xxx

logger:
  default: warning

detectors:
  ov:
    type: openvino
    model: 
      path: /openvino-model/ssdlite_mobilenet_v2.xml

model:
  width: 300
  height: 300
  input_tensor: nhwc
  input_pixel_format: bgr
  labelmap_path: /openvino-model/coco_91cl_bkgr.txt

ffmpeg:
  hwaccel_args: preset-vaapi
#    - -hwaccel
#    - vaapi
#    - -hwaccel_device
#    - /dev/dri/renderD128
#    - -hwaccel_output_format
#    - yuv420p

  #output_args:
    # Optional: output args for detect streams (default: shown below)
    #detect: -f rawvideo -pix_fmt yuv420p
    # Optional: output args for record streams (default: shown below)
    #record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an
    # Optional: output args for rtmp streams (default: shown below)
    #rtmp: -c copy -f flv -flvflags no_duration_filesize

rtmp:
  enabled: False

snapshots:
  enabled: True
  timestamp: false
  bounding_box: true
  retain:
    default: 3

birdseye:
   enabled: True
   mode: continuous

#Confirm an object is still there periodically
detect:
   stationary:
       interval: 50

# Required
cameras:
  # Required: name of the camera
  basementnorth:

    ffmpeg:
      # Required: A list of input streams for the camera. See documentation for more information.

      inputs:
        # Required: the path to the stream
        # NOTE: path may include environment variables, which must begin with 'FRIGATE_' and be referenced in {}
        # https://github.com/roleoroleo/yi-hack-Allwinner-v2
        #- path: rtsp://192.168.2.241/ch0_0.h264
          # Required: list of roles for this stream. valid values are: detect,record,rtmp
          # NOTICE: In addition to assigning the record, and rtmp roles,
          # they must also be enabled in the camera config.
          #roles:

        - path: rtsp://192.168.2.135/ch0_0.h264
          roles:
            - record
            - detect

    motion:
       mask:
         - 167,280,458,282,440,164,212,174

    detect:
      width: 640
      height: 360
      fps: 2

    objects:
      mask:
        - 167,280,458,282,440,164,212,174

      track:
        - person
        - dog
        - cat

    # Required: name of the camera
  garagecam:

    ffmpeg:

      inputs:
        - path: rtsp://192.168.2.204/ch0_0.h264
          roles:
            - record
            - detect

    detect:
      fps: 2

  kennalcam1:
    ffmpeg:
      inputs:
        - path: rtsp://admin:xxxxx@192.168.2.127:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - record
            - detect

    motion:
      mask:    
         - 1639,730,2792,690,3566,849,3840,944,3840,0,0,0,0,925,901,767
         - 1928,142,2506,136,2501,81,1924,81

    detect:
      width: 2592
      height: 1944
      fps: 2

    objects:
      mask:
         - 1639,730,2792,690,3566,849,3840,944,3840,0,0,0,0,925,901,767

  northcorner:
    ffmpeg:
      inputs:
        - path: rtsp://admin:xxxx@192.168.2.182:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - record
            - detect

    motion:
       threshold: 50
       mask:
          - 1639,730,2792,690,3566,849,3840,944,3840,0,0,0,0,925,901,767       
    detect:
      width: 3840
      height: 2160
      fps: 3

    objects:
      track:
         - car
         - dog
         - cat
         - person

      filters:
         car:
           mask:
              - 0,1671,734,1515,708,1028,0,758

  dogyard:
    ffmpeg:
      inputs:
        - path: rtsp://admin:xxxx@192.168.2.227:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - record
            - detect

    detect:
      width: 2592
      height: 1944
      fps: 3

    motion:
       mask:
         - 1934,143,2505,143,2498,70,1927,68 
         - 542,250,881,0,0,0,0,308

    objects:
       track:
         - person
         - dog
         - car

       filters:
          person:
             mask:
                - 2233,1213,1178,983,651,1944,2592,1944
                - 2208,397,2176,629,2069,615,2090,399

record:
  enabled: true
  retain:
    days: 60

# Optional: Object configuration
# NOTE: Can be overridden at the camera level
objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - dog

  filters:
    person:
      threshold: 0.83
    car:
      threshold: 0.68

Any other relevant information

No response

SgtBatten commented 11 months ago

I'm a bit perplexed by this one.

I'm no network guru but it seems more likely to be a configuration thing than a blueprint thing. Perhaps to do with the companion app somehow. Is it trying to open in the companion app or safari initially?

rrosson commented 9 months ago

For iOS devices when clicking on the notification it attempts to open the snapshot in Safari.

guoqiang881245 commented 1 week ago

I also encountered a situation where Safari could not open the connection, but copied it to the PC browser, and the PC browser could not open the video after pressing F12 and refreshing.