mrlt8 / docker-wyze-bridge

WebRTC/RTSP/RTMP/LL-HLS bridge for Wyze cams in a docker container
GNU Affero General Public License v3.0
2.61k stars 161 forks source link

WYZE motion/sound/pir light activation broken #661

Open doylejg opened 1 year ago

doylejg commented 1 year ago

After installing the wyze-bridge docker my floodlight automations from the WYZE app no longer work (or at least are inconsistent). Is that something others have noticed? Is this a bug, or is it a pebcak situation?

mrlt8 commented 1 year ago

It shouldn't but it could be the extra traffic from the camera causing some congestion. Is the camera on the latest firmware? Does setting the bridge to ON_DEMAND help?

  environment:
    - ON_DEMAND=True
doylejg commented 1 year ago

Sorry, didn't see this reply.

Firmware: Up to date (4.36.10.3406) ON_DEMAND: I did not have that set, I just set it and recreated the container. I will check back tonight.

doylejg commented 1 year ago

Back to this again. So this suggestion fixed the camera's behaviour, but now the wyze-bridge is not working. Things do not seem to want to share streams. I feel like there must be something deeper going on here, like maybe I'm maxing out the bandwidth of the camera or something. If you have a minute to look at my docker-compose and config files, I would be super appreciative. Here are my wyze-bridge and frigate files:

version: '2.4'
services:
    wyze-bridge:
        container_name: wyze-bridge
        restart: unless-stopped
        image: mrlt8/wyze-bridge:latest
        ports:
            - 1936:1935 # RTMP
            - 8554:8554 # RTSP
            - 8888:8888 # HLS
            - 5050:5000 # WEB-UI
        environment:
            - ON_DEMAND=True
            - WYZE_EMAIL= # Replace with wyze email 
            - WYZE_PASSWORD= # Replace with wyze password

The RTMP port change is intentional and I forget why exactly. I guess I have two streams from localhost? Oh yes! Frigate itself uses 1935 for RTMP.

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: blakeblackshear/frigate:stable-amd64nvidia
    shm_size: "64mb" # update for your cameras based on calculation above
    devices:
      # - /dev/bus/usb:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
      - /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/homeassistant/home_automation/homeassistant/config/frigate.yml:/config/config.yml:ro
      - /media/storage/frigate:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
    environment:
      FRIGATE_RTSP_PASSWORD: 
    deploy:   
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

and finally the config for frigate, the wyze-bridge feed is driveway. Looks like i'm using rtsp anyway, not rtmp.

mqtt:
  host: media-server.local
  user: 
  password: 

detectors:
  cpu1:
    type: cpu
    num_threads: 2
  cpu2:
    type: cpu
    num_threads: 2
  # cpu3:
  #   type: cpu
  #   num_threads: 2

ffmpeg:
  hwaccel_args: -c:v h264_cuvid
  # hwaccel_args:
  # - -hwaccel
  # - vaapi
  # - -hwaccel_device
  # - /dev/dri/renderD128
  # - -hwaccel_output_format
  # - yuv420p

cameras:
  driveway:
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.165:8554/driveway-cam
          roles:
            - record
            - rtmp
#              - path: rtmp://localhost:1936/driveway-cam
            - detect
    motion:
      mask:
        - 830,0,828,69,655,85,48,334,0,303,0,0
    objects:
      filters:
        car:
          mask:
            - 407,268,546,259,661,183,650,64,399,87
  garden:
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.191:554/videoMain
          roles:
            - record
            - rtmp
            # - path: rtsp://10.0.0.191:554/videoSub
            #   roles:
            - detect
    # detect:
    #   width: 640
    #   height: 360
    motion:
      mask:
        - 1280,0,1280,303,960,227,685,291,681,199,522,175,509,286,404,296,188,232,188,198,0,206,0,0

  backyard:
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.192:554/videoMain
          roles:
            - record
            - rtmp
            # - path: rtsp://10.0.0.192:554/videoSub
            #   roles:
            - detect
    # detect:
    #   width: 640
    #   height: 360
    motion:
      mask:
        - 921,315,1280,476,1280,0,1212,0,1240,184,1157,113,1113,0,1065,0,1028,64,960,112,996,0,693,0,609,148,522,45,416,28,270,95,287,256

    objects:
      filters:
        car:
          mask:
            - 129,250,248,251,256,136,125,143

record:
  enabled: True
  events:
    max_seconds: 1800
    pre_capture: 10
    post_capture: 10
    retain:
      default: 30

snapshots:
  enabled: True
  retain:
    default: 30

birdseye:
  enabled: True

motion:
  threshold: 25
mrlt8 commented 1 year ago

Can you access the video if you try to open rtsp://10.0.0.165:8554/driveway-cam directly?

doylejg commented 1 year ago

I cannot -- Okay after debugging, I realize that when I rebuild the container I had to re enter my MFA. Pulled updated image as well, so now I can actually test your original suggestion of - ON_DEMAND=True.

Will report back soon, thanks again.