home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.53k stars 30.72k forks source link

Unifi Protect crashes Homeassistant when RTSP enabled (instant) #83766

Closed thezepter closed 1 year ago

thezepter commented 1 year ago

The problem

Hello,

Unifi Protect only works for me if I select the option: "Disable RTSP Stream" in the addon settings. If I don't set this option, I get thumbnails in the dashboard of each camera, but as soon as I click on a camera to open the livestream, Homeassistant restarts immediately. No matter which camera I use.

What version of Home Assistant Core has the issue?

2022.11.X - 2022.12.1

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

Unifi Protect

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Unifi Protect 2.6.17 / UCK G2+ Network: 192.168.1.X

HomeAssistant: 2022.11.X - 2022.12.1 Network: 192.168.2.X

Cams: 192.168.2.X & 192.168.1.X image

image

home-assistant[bot] commented 1 year ago

Hey there @briis, @angellusmortis, @bdraco, mind taking a look at this issue as it has been labeled with an integration (unifiprotect) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `unifiprotect` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign unifiprotect` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


unifiprotect documentation unifiprotect source (message by IssueLinks)

AngellusMortis commented 1 year ago

Please provide debug logs and diagnostics (requires v2022.12.0 or newer).

thezepter commented 1 year ago

I´ve enabled rtsp option, klick on a video cam stream, HA crashed -> downloaded the logs an diagnostics.

config_entry-unifiprotect-345d9147b40c64c0af9b6d3bc0164d96.json.txt home-assistant_unifiprotect_2022-12-11T16-11-48.958Z.log

AngellusMortis commented 1 year ago

There are no errors in the logs from the UniFi Protect or stream integrations. Some recommendations to track down the issue:

Without an error for the restart, there is unfortunately not much I can do to help. RTSP streams are a critical part of HA and security cameras, not just to the UniFi Protect integration. So that means there is likely something different about your install that is causing you to have issues others do not.

thezepter commented 1 year ago

very sad, had hoped for any detectable errors. Time sync fits. I also had a fresh HA installation running with just the Unifi Protect plugin. It comes to the same result. The VM has 8GB RAM and currently uses about 50%-60%.

Small story in addition: For the last 2 years I had a Homebridge running (no HA) and there the Unifi plugin worked cleanly until about half a year ago. Then suddenly only the preview videos ran and as soon as you wanted to open the stream of a camera came no video and many ffmpeg error in the Homebridge. After that I had no more desire to HomeBridge and have looked at HomeAssistant. Could not find anything to the error even on google. Ne idea why this occurs only with me I have not yet, so I thought maybe someone knows here further.
Thanks anyway !

I could not find anything in the doc about the "disable rtsp function". How will the videos be displayed when rtsp is turned off ?

AngellusMortis commented 1 year ago

By default, the integration will detect if you have RTSP enabled on your cameras (it looks like you have it enabled on all of your cameras). If it is enabled, it adds the RTSP(S) URL to the camera entity so HA can create a stream for it.

If you enable the "Disable the RTSP stream", it disables that functionality. It will not include the RTSP(S) stream for the camera entity so the camera will basically act as a static image that is refreshed about once a second. So effectively it will disable streaming the camera in realtime inside of HA.

AngellusMortis commented 1 year ago

Possibly related: https://github.com/home-assistant/core/issues/83773. Are you able to check to see if this still happens on v2022.11.x?

bdraco commented 1 year ago

fixed via #83795

bdraco commented 1 year ago

Please update to 2022.12.3. Thanks 👍

thezepter commented 1 year ago

Possibly related: #83773. Are you able to check to see if this still happens on v2022.11.x?

Yes, the same.

updated, but HA crash again with rtsp activated.

It is possible to test this Addon with rtsp instead of rtsps ? would like to rule out all possible error sources

unifi allows both: (other port) rtsps://192.168.1.100:7441/iFOBr4CBLseGF8vh?enableSrtp rtsp://192.168.1.100:7447/iFOBr4CBLseGF8vh

thezepter commented 1 year ago

I have been able to isolate the problem. It must be because HA is running on Synology in Virtual Machine Manager. Something must be causing the problem. openswitch or similar. I don't have any idea what else to do here though.

If I run homeassistant in a virtual box on my normal PC, the livestream works with rtsp.