AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.48k stars 174 forks source link

2way audio, might be silly #750

Open Archy54 opened 4 weeks ago

Archy54 commented 4 weeks ago
type: custom:webrtc-camera
streams:
  - url: onvif://admin:pass@192.168.x.x:80?subtype=MediaProfile00000
    mode: webrtc
    media: video,audio,microphone
menu:
  buttons:
    microphone:
      enabled: true
      icon: mdi:microphone
      type: momentary

Alternative

type: custom:webrtc-camera
streams:
  - url: >-
      rtsp://admin:~hidden@192.168.x.x/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
    mode: webrtc
    media: video,audio,microphone
live:
  microphone:
    disconnect_seconds: 2
menu:
  buttons:
    microphone:
      enabled: true
      icon: mdi:microphone
      type: momentary

I think also worked but not via nabucasa. So this works as an always recording microphone on laptop only when enabled, but not home assistant phone app nabu casa but I can't see a button for a push to talk in either webrtc card, does it exist? Can I make one? one I can hold down like a doorbell. I've tried so many different bits of code but I can't figure it out. I got frigate hass card with hold down microphone but it only works on browser, not naba casu app. EmpireTech-IPC-T5442T-ZE-Vari-Focal s3 (dahua 5442 s3)

Frigate Server (LXC) go2rtc

api:
  origin: '*'
hass:
  config: /config
log:
  format: text
rtsp:
  default_query: mp4
streams:
  Car_Port_North:
  - rtsp://admin:~hidden@192.168.x.x:554/cam/realmonitor?channel=1&subtype=0
  - ffmpeg:Car_Port_North_2way_audio#audio=opus
  Shed:
  - rtsp://admin:~hidden@192.168.x.x:554/cam/realmonitor?channel=1&subtype=0
  - ffmpeg:Shed#audio=opus
webrtc:
  candidates:
  - stun:8555

Frigate Server (LXC) Frigate Config

mqtt:
  enabled: true
  host: 192.168.x.x
  port: 1883
  topic_prefix: hidden
  client_id: hidden
  user: hidden
  password: hidden

cameras:
  Car_Port_North:
    enabled: true
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-aac
      inputs:
        - path: rtsp://admin:~hidden@192.168.x.x:554/cam/realmonitor?channel=1&subtype=0
          input_args: preset-rtsp-restream
          roles:
            - record
            - detect
    detect:
      enabled: true
      width: 1920
      height: 1080
      fps: 5
      min_initialized: 2
      max_disappeared: 25
    record:
      enabled: true
      retain:
        days: 2  # Adjust the number of days you want to keep recordings
      events:
        pre_capture: 5  # Seconds before event to capture
        post_capture: 10  # Seconds after event to capture
    zones:
      CarPortNorthZone:
        coordinates: 0,0,1,0,0.991,0.603,0.877,0.992,0.002,0.995
        loitering_time: 0
  Shed:
    enabled: true
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-aac
      inputs:
        - path: rtsp://admin:~hidden@192.168.x.x:554/cam/realmonitor?channel=1&subtype=0
          input_args: preset-rtsp-restream
          roles:
            - record
            - detect
    zones:
      ShedZone:  # Rename this zone to ShedZone to avoid conflict with the camera name
        coordinates: 0,0,2688,0,2688,1520,0,1520  # Define the zone coordinates
    detect:
      enabled: true
      width: 2688
      height: 1520
      fps: 5
      min_initialized: 2
      max_disappeared: 25
    record:
      enabled: true
      retain:
        days: 2  # Adjust the number of days you want to keep recordings

objects:
  track:
    - person
    - cat
    - dog
    - bicycle
    - motorcycle

detectors:
  coral:
    type: edgetpu
    device: usb

version: 0.14

logger:
  logs:
    frigate.record.maintainer: debug

Frigate hass card

type: custom:frigate-card
cameras:
  - camera_entity: camera.car_port_north
    live_provider: go2rtc
    go2rtc:
      modes:
        - webrtc
    webrtc_card: {}
    id: Car Port North 
  - camera_entity: camera.shed_2
    live_provider: go2rtc
    go2rtc:
      modes:
        - webrtc
menu:
  style: outside
  buttons:
    cameras: {}
    clips:
      icon: mdi:film
      alignment: matching
      enabled: true
    frigate:
      enabled: true
    recordings:
      enabled: true
    microphone:
      enabled: true
      disconnect_seconds: 2
      alignment: opposing
      type: momentary
    image:
      enabled: true
media_gallery:
  controls:
    thumbnails:
      show_details: true
live:
  microphone:
    disconnect_seconds: 2
view:
  scan:
    enabled: false
AlexxIT commented 2 weeks ago

microphone will only work on HTTPS pages. This also applies to the Hass mobile app.