question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RTSPtoWebRTC camera.frontend_stream_type reverts to 'hls' after HA startup

See original GitHub issue

The problem

The RTSPtoWebRTC integration successfully modifies the attribute frontend_stream_type of cameras to web_rtc whenever I reload the integration. However, when HA core restarts, all cameras revert to hls. To get WebRTC working again I need to reload the RTSPtoWebRTC integration. This also happened in v2022.04, before I upgraded to 2022.05 yesterday.

The cameras in question are working through the ONVIF integration. From looking through the logbook, I suspect a race condition between the ONVIF integration and the RTSPtoWebRTC integration.

To analyse this I added some template sensors like the following to track the value of the frontend_stream_type attribute of the cameras:

- name: driveway_stream_type
  state: "{{ state_attr('camera.driveway_camera_mainstream', 'frontend_stream_type') }}"

Here’s what happens to that template sensor during and after a restart: frontend_stream_type_history

Here’s an abridged version of the Logbook showing relevant events during that restart: abridged logbook

I note from the “System Health” page that ONVIF had a 36s startup time. integration_startup_time

RTSPtoWebRTC starts up faster than ONVIF, which makes it seem like a race condition to me.

In the meantime, I have automated reloading the integration with the following (where entry_id is the value in my .storage/core.config_entries file for the rtsp_to_webrtc entry):

alias: Reload RTSPtoWebRTC after restart
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - delay:
      minutes: 1
  - service: homeassistant.reload_config_entry
    data:
      entry_id: 5033d785b092d50d530138c64c1f20d9
mode: single

What version of Home Assistant Core has the issue?

2022.5.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

rtsp_to_webrtc

Link to integration documentation on our website

https://www.home-assistant.io/integrations/rtsp_to_webrtc/

Diagnostics information

config_entry-rtsp_to_webrtc-5033d785b092d50d530138c64c1f20d9.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
allenportercommented, May 11, 2022

OK I tagged onvif, but now will untag onvif and dig a little bit more assuming its an rtsp_to_webrtc bug.

0reactions
scadman1commented, Oct 14, 2022

Hi Allen, I’m happy to try it. My cameras are using the ONVIF integration via the DVR but that shouldn’t effect the test?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add on: RTSPtoWeb and RTSPtoWebRTC - Home Assistant OS
The RTSPtoWeb add-on lets you convert your RTSP streams to WebRTC, HLS, LL HLS, or even mirror as a RTSP stream. The RTSPtoWeb...
Read more >
Real Time Camera Viewing using RTSPtoWeb and Glance ...
Here is yet another and better option for live streaming cameras using the RTPStoWeb Add-on and the WebRTC integration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found