I understand, the information you provided was useful for ruling other causes out.
You can try using a reverse proxy - it should be straightforward to set up and should improve your HA frontend speed.
Nope. 10 charrrr
Hmm, I’m not sure we can add that into the HA documentation itself as there are many different reverse proxies and I don’t think HA recommends any particular one.
For HA OS users, I think there are one or two addons like this: GitHub - hassio-addons/addon-nginx-proxy-manager: Nginx Proxy Manager - Home Assistant Community Add-ons and that should configure the proxy for you.
Otherwise, you can have a look at this community guide Reverse proxy using NGINX - Community Guides - Home Assistant Community (home-assistant.io) which should have a good configuration for HA. I notice that it doesn’t have http2 enabled though - I’ll try to add it now.
Nope. 10 charrrr
I just tried using the settings in your link and they seem ok for me.
However, my setup is a little different as I’m using nginx-quic. If you’re comfortable using docker and building a docker image you can give it a try. QUIC and HTTP/3 should provide a performance benefit over even HTTP/2. I’m just a regular nginx user and not an expert, but if you’re interested I can make a post on my setup. However, our messages have veered quite a bit off this Feature Request, so PM me if you’re interested in this.
Has anyone had any luck with using WebRTC with the new beta 2021.12.0b0 yet? Everything worked perfectly with all previous version of HA but now gives me this error during setup:
This error originated from a custom integration.
Logger: homeassistant.setup
Source: custom_components/webrtc/utils.py:74
Integration: WebRTC Camera (documentation, issues)
First occurred: 7:19:16 PM (1 occurrences)
Last logged: 7:19:16 PM
Error during setup of component webrtc
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 229, in _async_setup_component
result = await task
File “/config/custom_components/webrtc/init.py”, line 75, in async_setup
utils.register_static_path(hass.http.app, url_path, path)
File “/config/custom_components/webrtc/utils.py”, line 74, in register_static_path
app’allow_cors’
File “/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py”, line 186, in getitem
return self._state[key]
KeyError: ‘allow_cors’
Nope. 10 charrrr
Am i right in thinking that this is what the November HA Release Notes were referring to?
@allenporter blew our minds this release by adding initial support for WebRTC streams and cameras to Home Assistant.
But had a good reason, he added support for Nest Battery Cameras and Nest battery Doorbell Cameras to Home Assistant! Thanks @allenporter!
I have been following this “scene” for some time, and I wasn’t sure if I got myself confused or if the information available on the topic is indeed sparse and slightly misleading? e.g. the release notes
PS: i guess for the sake of clarity my interest in this is based on using the the Unifi Protect integration and the delays that come with it (i know they are not through any fault of the integration - and I am sure that the moment there is a better approach, the core contributors like @AngellusMortis will try to get it natively implemented - hence my confusion on WebRTC)
Thank you all
PPS: let me know if I can be of any help on the testing side of things
Nope. 10 charrrr
Realtime camera streaming without any delay - WebRTC - #360 by allenporter explains the difference in what exists now and what the custom component does today.
You should check out low latency HLS.
Yep I am aware. I was referring to core contributors to the Unifi Protect integration
Thank you for providing the link to that comment. Gave me a better understanding of what work was actually done versus what I thought happened.
I’ve had this on my todo list for some time, life just kept me busy recently.
Thank you both for your answers!
Hey guys,
Any chance I could pick your brain for some information?
I have tried the LL-HLS with the default configuration (from HA stream documentation) and indeed I am seeing an improvement. That is both on HTTP2 via custom domain but also HTTP1.1 via direct IP on local network (both phone and wallpanel).
I was wondering if you could share some more info on the part_duration and segment_duration attributes. The documentation is not very explicit in terms of what is the actual effect of changing the values.
Much appreciated
HLS has segments, while LL-HLS splits these segments further into parts. With LL-HLS, the part_duration
should be the main thing that will affect your latency. The defaults should be good for most, and changing it too much may cause things to break, but you could try lowering the part_duration
a little to see if it improves latency even further. If you lower it, you can also lower segment_duration
a bit because you don’t want to get too many parts in a segment (that results in increased messaging overhead). A good rule of thumb would be to keep the ratio segment_duration/part_duration
around 4-8.
I actually haven’t played with the settings extensively myself and I think the defaults are fine (hence the lack of documentation), but if you find out any interesting results please let us know.
Hi folks, Chris posted a great video talking about LL-HLS and the RTSPtoWeb Add-on for folks who want to learn more about the current state of things: Real Time Camera Viewing using RTSPtoWeb and Glance Cards in Home Assistant. - YouTube
Is it worth marking this as solved now? I think it’s worth updating that
- LL HLS is now on by default and should satisfy most users (~4-5s). Maybe a couple more things we want to fix for initial startup latency
- The rtsp to webrtc add-on now exists and is also an option though has caveats, but can be improved over time.
Got it, I considered these projects to be solved but I realize given unifi protects aren’t working at all I hear you. We updated the certificate handling and now ignore the bad cert. Do you know what is different about the rtsps stream compared to the rtsp stream otherwise that still causes it not to work? I personally won’t be able to do anything about it since I don’t have one, but it certainly seems close to a solution.
Yes, I agree audio re-encoding and stream preloading would be great improvements.
One other angle I’ve thought about is doing a hybrid of stream
with pyav and the python webrtc as a fun proof of concept, since it’ll have better stream support in general.
Edit: Sure, I’m not feeling discredited, what I mean to say is they are “projects” we should tee up and go solve. I don’t think I worded that clearly. My initial point was to update the status from 2022.02 (e.g. LL HLS is now on by default and the edit says it’s on beta) and you’re right webrtc is not complete yet.
Are unifi protect rtsp urls stable? I’m curious if just setting on demand=false in the config is enough so that they are always preloaded after initially registered.
If so, that one could be straight forward to address.
@AngellusMortis just curious, which method did you land on for accessing your UniFi Protect streams via HA?
I’ve been using WebRTC since well before the LL-HLS default was made earlier this year, but I’m starting to see some slow down in my UniFi Protect live streams via the official app, so I’m troubleshooting with disabling the WebRTC streams to see if that’s causing it.