go2rtc icon indicating copy to clipboard operation
go2rtc copied to clipboard

Ring Battery Doorbell Plus: empty h264 stream used + leaves producer running indefinitely draining battery

Open h3nnes opened this issue 1 month ago • 2 comments

I use a Ring Battery Doorbell Plus with Home-Assistant 2025.11.3 and go2rtc (master) pulled 2 days ago.

In my home-assistant dashboard I use a custom:webrtc-camera card inside a picture-glance card. The picture-glance card displays snapshots of the last captured events, and the custom:webrtc-camera card is used for live video with two-way audio.

My picture-glance card yaml config:

camera_view: auto
fit_mode: cover
type: picture-glance
title: Klingel
camera_image: camera.turklingel_live_ansicht
image:
  media_content_id: https://demo.home-assistant.io/stub_config/kitchen.png
entities:
  - entity: sensor.turklingel_batterie
  - entity: input_button.gegensprechanlage
    tap_action:
      action: fire-dom-event
      browser_mod:
        service: browser_mod.popup
        data:
          title: Türklingel Gegensprechanlage
          dismissable: true
          autoclose: false
          content:
            type: custom:webrtc-camera
            url: ring
            mode: webrtc
            media: video,audio,microphone
            muted: false

My go2rtc yaml config file:

log:
  level: debug

streams:
  ring: ring:?camera_id=<camera-id>&device_id=<device-id>&refresh_token=<my-token>

As soon as I try to open the two way audio livestream from the ring camera by using a button entity at the bottom of the picture-glance card, the stream window popup is opened but no video is displayed, instead the stream window says "loading" indefinitely.

Image Image

In the debug logs of go2rtc, I can see that a new consumer was discovered and a producer was started, but the problem is that the consumer first tries to connect to the empty h264 stream, while the hevc stream sends stream data reliably.

Debug logs of go2rtc as soon as I hit the action button at the bottom of the picture glance card:

14:00:26,247	debug	[streams] start producer url=ring:?camera_id=<camera-id>&device_id=<device-id>&refresh_token=<my-token>
14:00:24,597	debug	[webrtc] new consumer src=ring

net screenshot, where the h264 stream is used instead of the hevc one:

Image

Now this is a bit odd: As soon as I immediately close and reopen the live view so that the producer is still on, the correct hevc stream is used this time and displayed and I get working two way audio.

Image

The issue unfortunately is, that whenever I close the stream now, the producer is not stopped and runs indefinitely as a ghost producer and drains the battery (there are no consumers, just the producer still running).

Image

Quick recap:

  • I press the action button on the picture-glance card to open a live view popup window
  • The stream video is not displayed (blank screen with "loading..."), but a producer is spawned and a consumer is registered (but consumer consumes the wrong stream (h264))
  • immediate reopen of the live view displays the correct hevc stream with working two-way audio
  • But after closing the window again, the producer is not stopped (although there are no more consumers) and drains the battery of the doorbell

So my questions are:

  1. Is there a way to force the custom:webrtc-camera card to use the hevc stream only (ignoring the empty h264 stream)?
  2. Regarding the ghost producer: Is it a bug or expected behaviour that the producer is still running without any consumers?

It looks like at the moment there's no way for me to get a working webrtc stream with two-way audio that can be properly closed so the producer is stopped afterwards.

Thanks!

h3nnes avatar Nov 30 '25 13:11 h3nnes

@seydx

AlexxIT avatar Dec 01 '25 09:12 AlexxIT

As a PoC, I've compiled my own go2rtc binary with some patches from this branch (with a little help of non-biological intelligence). When I specify h265 as the preferred stream codec in the go2rtc.yaml file, the webrtc stream + two-way audio works instantly the first time I try to open it.

go2rtc.yaml content:

log:
  level: debug

streams:
  ring:
    url: ring:?camera_id=<camera-id>&device_id=<device-id>&refresh_token=<token>&timeout=5
    video: h265

logs from go2rtc:

$ ./go2rtc -c go2rtc.yaml 
12:17:45.748 INF go2rtc platform=linux/amd64 revision=mod.fbd5215 version=1.9.12
12:17:45.748 DBG build vcs.time=2025-11-26T08:24:57Z version=go1.24.5
12:17:45.748 INF config path=/home/user/go2rtc.yaml
12:17:45.748 DBG [streams] video codec preference codecs=["h265"]
12:17:45.748 INF [rtsp] listen addr=:8554
12:17:45.749 INF [api] listen addr=:1984
12:17:45.749 INF [webrtc] listen addr=:8555
12:18:14.712 DBG [webrtc] new consumer src=ring
12:18:17.036 DBG [streams] start producer url=ring:?camera_id=<camera-id>&device_id=<device-id>&refresh_token=<token>&timeout=5
12:18:51.036 DBG [streams] stop producer url=ring:?camera_id=<camera-id>&device_id=<device-id>&refresh_token=<token>&timeout=5

Quickly tested using this custom webrtc-camera card (Stream and two-way audio immediately works):

type: 'custom:webrtc-camera'
streams:
  - url: ring
    mode: webrtc
    media: video,audio,microphone

@seydx Any logs or further info that would help to fix this?

h3nnes avatar Dec 09 '25 08:12 h3nnes