starkillerOG / reolink_aio

Reolink NVR/camera API PyPI package
MIT License
65 stars 13 forks source link

Cameras get's unresponsive after awhile. #58

Closed mrmoller closed 5 months ago

mrmoller commented 7 months ago

Describe the bug Have multiple Reolink POE (820A, 823A) running but with the latest update I only see issues on my Duo 2 and the Track-Mix models. The issue has been there from when I added them in HA, but it's less frequently than earlier builds.

Can't say exactly when anymore with the latest release, but the cameras start being unresponsive, and then I can't access them via app, web or HA.
I can either reset POE and it will work for a while or I have to disable the connection in HA, and that takes xxx amount of time for them to start responding again.

To Reproduce

Wait and with earlier builds I could take 4-10 hours or sometimes a bit more, but usually with in the first 24 hours.

Expected behavior.

Environment: Please provide useful information about your environment, like: All cameras are added in HA and setup to push notifications when one of the smart detections are triggered. No stream or anything has been setup on any of the cams in HA till it was stable on all cams.

Reolink Duo 2 PoE Firmware: v3.0.0.1889_23031700 Hardware: IPC_529B17B8MP

Reolink TrackMix PoE Firmware: v3.0.0.2769_23100900 Hardware: IPC_529SD78MP

Additional context

starkillerOG commented 7 months ago

@mrmoller please download the diagnostic data for the CAMs with issues (Duo 2 and TrackMix) https://www.home-assistant.io/docs/configuration/troubleshooting/#download-diagnostics and post it here.

You can try disabeling all homeassistant reolink entities that you do not need in HomeAssistant. Data is only polled for entities which are enabled, so disabeling entities means less stress on the camera.

mrmoller commented 7 months ago

Have disabled a lot but can go over them again, but here are the logs.

Duo-2-config_entry-reolink.txt Track-Mix-config_entry-reolink.txt

mrmoller commented 6 months ago

Its still an issue even after disabling almost everything from the cameras, but only on the Track-Mix model now. What logs do you need?

starkillerOG commented 6 months ago

@mrmoller I see your camera's are both using "ONVIF long polling". This is fairly resource heavy on the camera, so it could be that the camera is getting itself into trouble due to too many requests to the cam.

"ONVIF push" is much easier on the camera.

Take a look at this section of the docs: https://www.home-assistant.io/integrations/reolink/#reducing-latency-of-motion-events Please try to adjust your network setup such that "ONVIF push" becomes possible. I think that will resolve your issues.

mrmoller commented 6 months ago

Thanks for the response.

Http is enabled on the internal address but has ssl on the public name.

What's the issue in that when you can connect to the internal ip?

Is the only solution to use nginx?

None of the cams have internet access, and that could be an issue as well.

starkillerOG commented 6 months ago

@mrmoller could also indeed be the block of internet, but in that case it would be a internall firmware bug of reolink. The camera could be hanging because it is trying to reach out to some reolink server. Did you disable the firmware update entity? Thats the only one that requires internet acces.

So do or don't you have a global SSL configured under http: in the configuration.yaml? If so that is blocking ONVIF Push since the SSL will also apply to the internal http address and reolink cams can't connect to that. In that case the only solution I know is using NGINX but there are probably more ways that basically do the same thing as NGINX.

mrmoller commented 6 months ago

@mrmoller could also indeed be the block of internet, but in that case it would be a internall firmware bug of reolink. The camera could be hanging because it is trying to reach out to some reolink server. Did you disable the firmware update entity? Thats the only one that requires internet acces.

So do or don't you have a global SSL configured under http: in the configuration.yaml? If so that is blocking ONVIF Push since the SSL will also apply to the internal http address and reolink cams can't connect to that. In that case the only solution I know is using NGINX but there are probably more ways that basically do the same thing as NGINX.

The firmware update is disabled on the cameras.

I do have a global ssl in the config, but have on the remote access enabled the internal http://local-ip address so it can be used internally. I figured that would be enough for Reolink to work as well.

I do have DNAT and Reflexive rules created in my firewall so could be the reason.

starkillerOG commented 6 months ago

@mrmoller nope, try going to homeassistant using http://local-ip/, you will see it will redirect to https or just fail. global ssl in the config is not an option if you want to get ONVIF push working with reolink.

mrmoller commented 6 months ago

@mrmoller nope, try going to homeassistant using http://local-ip/, you will see it will redirect to https or just fail. global ssl in the config is not an option if you want to get ONVIF push working with reolink.

You're right. Will try moving to nginx proxy instead, but are there no way to rewrite Reolink push to https? Intercept the request? Can see they try to connect to devices-apis.reolink.com but haven't seen that in documentation.

starkillerOG commented 6 months ago

Not a simple way that will work on all HomeAssistant setups. Keep in mind about 75.000 HomeAssistant installs are using the Reolink integration, so you would need something that works for basically all setups imaginable.

mrmoller commented 6 months ago

Not a simple way that will work on all HomeAssistant setups. Keep in mind about 75.000 HomeAssistant installs are using the Reolink integration, so you would need something that works for basically all setups imaginable.

I was thinking of ala dns rewrite and not the integration it self.

I got it working on nginx (broke AdGuard doh) so now its using push ONVIF instead.

Is there any way to see usage on the camera? I know it was viewable in earlier models.

starkillerOG commented 6 months ago

@mrmoller on a NVR you can see camera usage if you connect a screen and mouse directly to the NVR. Besides that I don't know of any way to see the CPU/memory usage on a camera.

mrmoller commented 5 months ago

Changing to nginx proxy it started using ONVIF push and haven't seen connection issues since.