blakeblackshear / frigate-hass-integration

Frigate integration for Home Assistant
MIT License
657 stars 110 forks source link

Camera view unavailable after installing Frigate 0.14.0B1 #682

Open weitheng opened 1 month ago

weitheng commented 1 month ago

Version of the custom_component

v5.2.0

Configuration


mqtt:
  # Required: host name
  host: XXX
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # NOTE: must be unique if you are running multiple instances
  topic_prefix: XXX
  # Optional: client id (default: shown below)
  # NOTE: must be unique if you are running multiple instances
  client_id: XXX
  # Optional: user
  user: hassio
  # Optional: password
  # NOTE: MQTT password can be specified with an environment variables that must begin with 'FRIGATE_'.
  #       e.g. password: '{FRIGATE_MQTT_PASSWORD}'
  password: XXX
  # Optional: tls_ca_certs for enabling TLS using self-signed certs (default: None)
#  tls_ca_certs: /path/to/ca.crt
  # Optional: tls_client_cert and tls_client key in order to use self-signed client
  # certificates (default: None)
  # NOTE: certificate must not be password-protected
  #       do not set user and password when using a client certificate
#  tls_client_cert: /path/to/client.crt
#  tls_client_key: /path/to/client.key
  # Optional: tls_insecure (true/false) for enabling TLS verification of
  # the server hostname in the server certificate (default: None)
#  tls_insecure: false
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 5

go2rtc:
  streams:
    Gate:
      - rtsp://XXX:554/cam/realmonitor?channel=1&subtype=0 # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg
      - ffmpeg:Gate#audio=opus   # <- copy of the stream which transcodes audio to opus
    Gate_sub:
      - rtsp://XXX:554/cam/realmonitor?channel=1&subtype=1 # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg
    GateWide:
      - rtsp://XXX@192.168.0.207:554/stream1 # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg
    GateWide_sub:
      - rtsp://XXX@192.168.0.207:554/stream2 # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg
    GateExtra:
      - rtsp://XXX@192.168.0.203:554/cam/realmonitor?channel=1&subtype=0 # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg
    GateExtra_sub:
      - rtsp://XXX@192.168.0.203:554/cam/realmonitor?channel=1&subtype=1 # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg

# Optional: Detectors configuration. Defaults to a single CPU detector
detectors:
  tensorrt:
    type: tensorrt
    device: 0 #This is the default, select the first GPU
#  coral:
#    type: edgetpu
#    device: usb
#    model:
#      path: "/edgetpu_model.tflite"
#      width: 320
#      height: 320
#  cpu1:
#    type: cpu
#  cpu2:
#    type: cpu
#  cpu3:
#    type: cpu
#  cpu4:
#    type: cpu
    # Optional: num_threads value passed to the tflite.Interpreter (default: shown below)
    # This value is only used for CPU types
#    num_threads: 3

# Optional: model modifications
model:
  # Optional: path to the model (default: automatic based on detector) /edgetpu_model.tflite
  path: /config/model_cache/tensorrt/yolov7-320.trt
  input_tensor: nchw
  input_pixel_format: rgb
  width: 320
  height: 320
#/edgetpu_model.tflite
#/spaghettinet_edgetpu_l_compiled.tflite 
  # Optional: path to the labelmap (default: shown below)
#  labelmap_path: /labelmap.txt
  # Required: Object detection model input width (default: shown below)
#  width: 320
  # Required: Object detection model input height (default: shown below)
#  height: 320
  # Optional: Label name modifications. These are merged into the standard labelmap.
#  labelmap:
#    2: vehicle

# Optional: logger verbosity settings
logger:
  # Optional: Default log verbosity (default: shown below)
  default: info
  # Optional: Component specific logger overrides
  logs:
    frigate.event: debug

# Optional: set environment variables
#environment_vars:
#  EXAMPLE_VAR: value

# Optional: birdseye configuration
# NOTE: Can (enabled, mode) be overridden at the camera level
birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: true
  # Optional: Restream birdseye via RTSP (default: shown below)
  # NOTE: Enabling this will set birdseye to run 24/7 which may increase CPU usage somewhat.
  restream: 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: objects

# Optional: ffmpeg configuration
ffmpeg:
  # Optional: global ffmpeg args (default: shown below)
  global_args: -hide_banner -loglevel warning -threads 2
  # Optional: global hwaccel args (default: shown below)
  # NOTE: See hardware acceleration docs for your specific device
  hwaccel_args: preset-nvidia-h264 #[]
  # Optional: global input args (default: shown below)
  input_args: preset-rtsp-generic
#-avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
  # Optional: global output args
  output_args:
    # Optional: output args for detect streams (default: shown below)
    detect: -threads 2 -f rawvideo -pix_fmt yuv420p
    # Optional: output args for record streams (default: shown below)
    record: preset-record-generic-audio-aac
#-f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an

# Optional: Detect configuration
# NOTE: Can be overridden at the camera level
detect:
  # Optional: width of the frame for the input with the detect role (default: shown below)
  width: 704
  # Optional: height of the frame for the input with the detect role (default: shown below)
  height: 576
  # Optional: desired fps for your camera for the input with the detect role (default: shown below)
  # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
  fps: 5
  # Optional: enables detection for the camera (default: True)
  # This value can be set via MQTT and will be updated in startup based on retained value
  enabled: true
  # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
  max_disappeared: 25
  # Optional: Configuration for stationary object tracking
  stationary:
    # Optional: Frequency for confirming stationary objects (default: shown below)
    # When set to 0, object detection will not confirm stationary objects until movement is detected.
    # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
    interval: 50
    # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
    threshold: 100
    # 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.
    # WARNING: Setting these values overrides default behavior and disables stationary object tracking.
    #          There are very few situations where you would want it disabled. It is NOT recommended to
    #          copy these values from the example config into your config unless you know they are needed.
    max_frames:
      # Optional: Default for all object types (default: not set, track forever)
      default: 5000
      # Optional: Object specific values
      objects:
        person: 3000

# Optional: Record configuration
# NOTE: Can be overridden at the camera level
record:
  enabled: true
  # Optional: Number of minutes to wait between cleanup runs (default: shown below)
  # This can be used to reduce the frequency of deleting recording segments from disk if you want to minimize i/o
  expire_interval: 60
  # Optional: Retention settings for recording
  retain:
    # Optional: Number of days to retain recordings regardless of events (default: shown below)
    # NOTE: This should be set to 0 and retention should be defined in events section below
    #       if you only want to retain recordings of events.
    days: 0
    # Optional: Mode for retention. Available options are: all, motion, and active_objects
    #   all - save all recording segments regardless of activity
    #   motion - save all recordings segments with any detected motion
    #   active_objects - save all recording segments with active/moving objects
    # NOTE: this mode only applies when the days setting above is greater than 0
    mode: all
  # Optional: Event recording settings
  events:
    # Optional: Number of seconds before the event to include (default: shown below)
    pre_capture: 40
    # Optional: Number of seconds after the event to include (default: shown below)
    post_capture: 30
    # Optional: Objects to save recordings for. (default: all tracked objects)
    objects:
      - person
      - car
      - bus
      - dog
      - cat
      - motorcycle
      - bicycle
    # Optional: Retention settings for recordings of events
    retain:
      # Required: Default retention days (default: shown below)
      default: 7
      # Optional: Mode for retention. (default: shown below)
      #   all - save all recording segments for events regardless of activity
      #   motion - save all recordings segments for events with any detected motion
      #   active_objects - save all recording segments for event with active/moving objects
      #
      # NOTE: If the retain mode for the camera is more restrictive than the mode configured
      #       here, the segments will already be gone by the time this mode is applied.
      #       For example, if the camera retain mode is "motion", the segments without motion are
      #       never stored, so setting the mode to "all" here won't bring them back.
      mode: active_objects

# Optional: Configuration for the jpg snapshots written to the clips directory for each event
# NOTE: Can be overridden at the camera level
snapshots:
  # Optional: Enable writing jpg snapshot to /media/frigate/clips (default: shown below)
  # This value can be set via MQTT and will be updated in startup based on retained value
  enabled: true
  # Optional: save a clean PNG copy of the snapshot image (default: shown below)
  clean_copy: true
  # Optional: print a timestamp on the snapshots (default: shown below)
  timestamp: true
  # Optional: draw bounding box on the snapshots (default: shown below)
  bounding_box: true
  # Optional: crop the snapshot (default: shown below)
  crop: false
  # Optional: height to resize the snapshot to (default: original size)
#  height: 175
  # Optional: Camera override for retention settings (default: global values)
  retain:
    # Required: Default retention days (default: shown below)
    default: 5

# Required
cameras:
  Foyer:
    birdseye:
      mode: continuous
    ffmpeg:
      inputs:
        - path: rtsp://XXX@192.168.0.201:554/Streaming/channels/102
          roles:
            - detect
        - path: rtsp://XXX@192.168.0.201:554/Streaming/channels/101
          roles:
            - record
    # Optional: timeout for highest scoring image before allowing it
    # to be replaced by a newer image. (default: shown below)
    best_image_timeout: 60
    objects:
      track:
        - person
        - car
        - dog
        - cat
        - motorcycle
        - bus
        - bicycle
      filters:
        car:
          threshold: 0.70
          mask:
            - 940,589,1280,619,1280,262,920,262
            - 880,120,880,65,730,50,705,103
        motorcycle:
          mask:
            - 422,228,436,179,429,124,372,121,349,180,355,226
        person:
          mask:
            - 236,191,255,190,253,155,233,156
    detect:
      width: 1280
      height: 720
      fps: 5
      # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
      max_disappeared: 50
      # Optional: Configuration for stationary object tracking
      stationary:
        threshold: 100
    motion:
      threshold: 40
#      contour_area: 20
    zones:
      driveway:
        coordinates: 944,720,915,160,877,122,671,102,568,143,0,598

# Optional
ui:
  # Optional: Set the default live mode for cameras in the UI (default: shown below)
  live_mode: mse
  # Optional: Set the time format used.
  # Options are browser, 12hour, or 24hour (default: shown below)
  time_format: 24hour
  # Optional: Set the date style for a specified length.
  # Options are: full, long, medium, short
  # Examples:
  #    short: 2/11/23
  #    medium: Feb 11, 2023
  #    full: Saturday, February 11, 2023
  # (default: shown below).
  date_style: short
  # Optional: Set the time style for a specified length.
  # Options are: full, long, medium, short
  # Examples:
  #    short: 8:14 PM
  #    medium: 8:15:22 PM
  #    full: 8:15:22 PM Mountain Standard Time
  # (default: shown below).
  time_style: medium
  # Optional: Ability to manually override the date / time styling to use strftime format
  # https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html
  # possible values are shown above (default: not set)
  strftime_fmt: '%Y/%m/%d %H:%M'
  timezone: Asia/Kuala_Lumpur

# Optional: in-feed timestamp style configuration
# NOTE: Can be overridden at the camera level
timestamp_style:
  # Optional: Position of the timestamp (default: shown below)
  #           "tl" (top left), "tr" (top right), "bl" (bottom left), "br" (bottom right)
  position: tl
  # Optional: Format specifier conform to the Python package "datetime" (default: shown below)
  #           Additional Examples:
  #             german: "%d.%m.%Y %H:%M:%S"
  format: '%m/%d/%Y %H:%M:%S'
  # Optional: Color of font
  color:
    # All Required when color is specified (default: shown below)
    red: 255
    green: 255
    blue: 255
  # Optional: Line thickness of font (default: shown below)
  thickness: 1
  # Optional: Effect of lettering (default: shown below)
  #           None (No effect),
  #           "solid" (solid background in inverse color of font)
  #           "shadow" (shadow for font)
  effect: shadow

# Optional: Telemetry configuration
telemetry:
  # Optional: Enable the latest version outbound check (default: shown below)
  # NOTE: If you use the HomeAssistant integration, disabling this will prevent it from reporting new versions
  version_check: true

Describe the bug

After installing Frigate 0.14.0 Beta 1, the camera view is no longer available.

Debug log


Camera Unavailable.
NickM-27 commented 1 month ago

Check Frigate logs

weitheng commented 1 month ago

Check Frigate logs

Sorry I was not clear. I can see the cameras just fine on Frigate, but when I try to view the cameras using this integration in Home Assistant, it says camera unavailable. The logs in Frigate looks fine

NickM-27 commented 1 month ago

how do you have frigate installed

weitheng commented 1 month ago

how do you have frigate installed

Using docker compose on another LXC container running Linux.

a-lunatic commented 1 month ago

I had similar issue but only 1 camera worked and just check now 2 working and 2 not working and haven't changed anything.

frigate running on ubuntu with docker

etymotic commented 1 month ago

For me, this problem presented itself because I changed my port configuration which broke the HA integration.

The old way was using port 5000:5000 in docker. Port 5000 has no need for a username/password. The new way (for me) was forwarding port 5000 to port 8080 which is new in the version 14 betas. 8080 has authentication, HA wasn't able to talk to it.

I've now configured my docker ports so that Home Assistant can still contact Frigate on port 5000, which still doesn't require any authentication.

weitheng commented 1 month ago

The integration seems to be broken on Frigate 0.14B - camera unavailable. @NickM-27 @dermotduffy is there anything we can help or logs we can provide to fix this?

NickM-27 commented 1 month ago

Everything is working as expected for me, and we've not seen mass reports of any issues

piscinas commented 3 weeks ago

I have similar problem! Since beta 1 to the last beta I can’t put to work! Something is wrong on go2rtc or ffmpeg services, because if I remove ffmpeg extra config from go2rtc, some times (after some reboots) I can see the red dot on wright corner. And the camera on homeassistant appears to work! And the camera function on integration… If I use the rtsp without ffmpeg I have the similar results. I think this is not an integration problem, since on frigate page system metrics does not work at all!


mqtt:
  host: x.x.x.x
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: mqtt_user
  password: mqtt_password
  stats_interval: 5

record:
  sync_recordings: true
  expire_interval: 60
  enabled: true
  retain:
    days: 0
    mode: motion
  preview:
    quality: medium
  events:
    pre_capture: 5
    post_capture: 10
    objects:
      - person
    retain:
      default: 1
      mode: active_objects

audio:
  enabled: true
  max_not_heard: 10
  min_volume: 500
  listen:
    - scream
    - fire_alarm
    - yell

detectors:
  coral:
    type: edgetpu

detect:
  fps: 7
  enabled: true
  max_disappeared: 25
  annotation_offset: 0

objects:
  track:
    - person
  filters:
    person:
      min_score: 0.7
      threshold: 0.75

snapshots:
  enabled: true
  clean_copy: true
  timestamp: true
  bounding_box: true
  crop: false
  height: 720
  retain:
    default: 1
    objects:
      person: 2

ui:
  timezone: Europe/Lisbon
  time_format: 24hour

go2rtc:

  streams:

    entrada:
      - ffmpeg:http://{FRIGATE_ENTRADA_HOST}/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user={FRIGATE_RTSP_USER}&password={FRIGATE_RTSP_PASSWORD}#video=copy#audio=copy#audio=opus
    traseiras:
      - ffmpeg:http://{FRIGATE_TRASEIRAS_HOST}/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user={FRIGATE_RTSP_USER}&password={FRIGATE_RTSP_PASSWORD}#video=copy#audio=copy#audio=opus
    frente:
      - ffmpeg:http://{FRIGATE_FRENTE_HOST}/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user={FRIGATE_RTSP_USER}&password={FRIGATE_RTSP_PASSWORD}#video=copy#audio=copy#audio=opus

cameras:

  entrada:
    enabled: true
    onvif:
      host: x.x.x.
      port: 8000
      user: xxxx
      password: xxxx
    ffmpeg:
      inputs:
        - path: rtsp://x.x.x.x:8554/entrada
          roles:
            - record
            - detect
            - audio
    motion:
      threshold: 30
      contour_area: 10
      improve_contrast: true

  traseiras:
    enabled: true
    ffmpeg:
      inputs:
        - path: rtsp://x.x.x.x:8554/traseiras
          roles:
            - record
            - detect
            - audio
    motion:
      threshold: 30
      contour_area: 10
      improve_contrast: true

  frente:
    enabled: true
    ffmpeg:
      inputs:
        - path: rtsp://x.x.x.x:8554/frente
          roles:
            - record
            - detect
            - audio
    motion:
      threshold: 30
      contour_area: 10
      improve_contrast: true

version: 0.14
DReffects commented 1 week ago

Same issue here. After upgrade to 0.14.0 Beta 3 no cameras anymore with integration.

NickM-27 commented 1 week ago

you most likely didn't switch the host name in the integration configuration after upgrading

DReffects commented 1 week ago

@NickM-27 I've added the devices with the new http://ccab4aaf-frigate-fa-beta:5000 hostname and enabled port 5000 in the frigate addon config screen. Is there anything else I have to do?

DReffects commented 1 week ago

follow up: I've deleted the frigate topic via mqtt explorer. now the switches for recording, detection etc work but not the camera stream. what kind of mqtt info is there to be expected for camera playback? I do not see any entry for any stream via mqtt.