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
71.06k stars 29.72k forks source link

Reolink Cameras Suddenly Offline #121972

Closed bbdaus closed 3 weeks ago

bbdaus commented 1 month ago

The problem

I’ve had the Reolink integration running 4 POE Reolink cameras for just over a year. About 3 weeks ago I pulled one of the LAN cables out while moving the router (not the first time this has happened). Two of the cameras were unplugged for a while. When I got them all plugged back in and connected to the Reolink app they stopped connecting to Home Assitant. I have had a timer running to check every few hours that the camera is connected and to warn me if it isn’t. I use the camera as an alarm system for anyone approaching the house, so it’s something I pay close attention to. The HA yellow and the cameras are all plugged into the same POE switch.

I’ve tried reinstating my HA to a backup from 3 months ago, but the integration still won’t log in.

I’ve tried making special HA logins on the cameras, but still get the same issue.

I’ve tried working through all the options in the troubleshooting guide to no avail. Also they have worked flawlessly for 18months, so it seems strange that some setting would suddenly need to be switched on, but I’ve tried all of them I can find.

My password and account work fine is I log in from any web browser.

Failed setup, will retry: Error while trying to setup 192.168.1.86:443: Client connector error during login of host 192.168.1.86:443: Host 192.168.1.86:443: connection error: Cannot connect to host 192.168.1.86:443 ssl:default [Connect call failed ('192.168.1.86', 443)]

What version of Home Assistant Core has the issue?

core-2024.7.2

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

Reolink

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Failed setup, will retry: Error while trying to setup 192.168.1.86:443: Client connector error during login of host 192.168.1.86:443: Host 192.168.1.86:443: connection error: Cannot connect to host 192.168.1.86:443 ssl:default [Connect call failed ('192.168.1.86', 443)]

Additional information

No response

home-assistant[bot] commented 1 month ago

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

Code owner commands Code owners of `reolink` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign reolink` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


reolink documentation reolink source (message by IssueLinks)

starkillerOG commented 1 month ago

If you login using a browser, are you using the same IP adress as the error in HomeAssistant?

Are you sure the HomeAssistant device is connected tot the same network as the camera's, no VLANs etc.?

wootner commented 1 month ago

Same issue ..3 Reolink POE camera's (all latest firmwares) 1 x RLC-1224A ..stoppen working about a week ago 1 x Doorcam Reolink Video Doorbell PoE stopped this week 1 x RLC-811A This is still working

Will investigate further ...codec or stream type error perhapse

OK working again the two that stopped were using auto DNS changed to manual and added router address .

sezlony commented 1 month ago

looks like it's the same randomly occuring error of "connect call failed", which I've been fighting with for a long time now

we had opened several topics on that, but there was never a solution

Logger: homeassistant.components.reolink
Source: helpers/update_coordinator.py:350
integration: Reolink IP NVR/camera (documentation, issues)
First occurred: July 15, 2024 at 12:36:03 PM (5 occurrences)
Last logged: 6:04:15 AM

Error fetching reolink.Back data: Host 192.168.1.6:80: connection error: Cannot connect to host 192.168.1.6:80 ssl:default [Connect call failed ('192.168.1.6', 80)]
Error fetching reolink.Back data: Host 192.168.1.6:80: Timeout error:
Error fetching reolink.Back data: API error during login of host 192.168.1.6:80: API returned HTTP status ERROR code 502/Bad Gateway
Error fetching reolink.Front data: channel-state: Error translating JSON response: unexpected character: line 1 column 1 (char 0), from commands ['GetEnc', 'GetIsp', 'GetMdState', 'GetIrLights', 'GetFtp', 'GetRec', 'GetAlarm', 'GetWifiSignal'], content type 'text/html', data: ickVwwZ4fohhOGnA1zbWRUJ68QQwK86koxwDNw4XsLclAmMA+MsnQBuxW5c3rjURVyyXTQ+ji2kZfYzC8viXZZYtQKPytvgy1WlDTSiKjiDz6e4LAyqlFCYuVH/8X/zEHRN+HuG28hNyOnSsseLO/6BqyonLZD6mLGhPTQ+WFrsXWU4iXvO5nQriSkdTmzUump8EO4E=
bbdaus commented 1 month ago

If you login using a browser, are you using the same IP adress as the error in HomeAssistant?

Are you sure the HomeAssistant device is connected tot the same network as the camera's, no VLANs etc.?

Yes I copied the IP address from the Reolink app, pasted it into browser and it logs into the camera.

The HA device is plugged into the same router as all four cameras.

starkillerOG commented 1 month ago

And you have checked that the IP adress you got from the reolink app and pasted in the browser is the same as used by HomeAssistant: 192.168.1.6:80

bbdaus commented 1 month ago

And you have checked that the IP adress you got from the reolink app and pasted in the browser is the same as used by HomeAssistant: 192.168.1.6:80

I think you’re mixing my post and another with the address above. But yes I’ve tried all the cameras different IP addresses. At one stage I deleted the devices and tried to add them using the IP addresses, but it won’t log in and establish the device. I’ve tried http and https ports.

starkillerOG commented 1 month ago

The 192.168.1.6 adress is from the logs, that is the IP that HomeAssistant is trying to use. Note that HomeAssistant is trying to use HTTP port 80, if you have only the HTTPS port enabled you need to setup the integration again to switch to port 443.

Please check wich ports are enabled on the Reolink camera, when a automatic firmware update happens it sometimes closes down ports.

sezlony commented 1 month ago

The 192.168.1.6 adress is from the logs, that is the IP that HomeAssistant is trying to use. Note that HomeAssistant is trying to use HTTP port 80, if you have only the HTTPS port enabled you need to setup the integration again to switch to port 443.

Please check wich ports are enabled on the Reolink camera, when a automatic firmware update happens it sometimes closes down ports.

I'm afraid the 192.168.1.6 comes from my comment, but it makes no difference :)

and how can the integration be set up again to a different port? do I have to delete the device and re-add or is there a less painful way?

starkillerOG commented 1 month ago

You are right, it was 192.168.1.86.

@sezlony you can just add the integration withouth removing the old one, it will update the settings of the existing one.

Moreover @sezlony your IP does not look to be static, did you do a DHCP reservation in your router? That could explain your occasionally disconnect issues when the IP changes

sezlony commented 1 month ago

@sezlony you can just add the integration withouth removing the old one, it will update the settings of the existing one.

do you mean I can readd the device without removing the existing one? I don't really wanna reconfigure the whole integration if it's not neccessary

Moreover @sezlony your IP does not look to be static, did you do a DHCP reservation in your router? That could explain your occasionally disconnect issues when the IP changes

just checked and IP reservation set for the cam [EDIT: in the router], so the mystery still remains why it randomly drops :(

sezlony commented 1 month ago

ok, I tried to add the same device again without removing the existing one and it's not possible:

Unexpected exception

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/reolink/config_flow.py", line 174, in async_step_user
    await host.async_init()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 173, in async_init
    await self.subscribe()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 401, in subscribe
    self.register_webhook()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 502, in register_webhook
    webhook.async_register(
  File "/usr/src/homeassistant/homeassistant/components/webhook/__init__.py", line 53, in async_register
    raise ValueError("Handler is already defined!")
ValueError: Handler is already defined!
bbdaus commented 1 month ago

The 192.168.1.6 adress is from the logs, that is the IP that HomeAssistant is trying to use. Note that HomeAssistant is trying to use HTTP port 80, if you have only the HTTPS port enabled you need to setup the integration again to switch to port 443.

Please check wich ports are enabled on the Reolink camera, when a automatic firmware update happens it sometimes closes down ports.

I’ve tried both the HTTPS ports at 443, I’ve tried port 80 on http. I’ve switched on the https port and off the http port, I’ve switched off the https and off the http, I’ve switched on both ports. I’ve tried this for all 4 cameras. Nothing changes.

starkillerOG commented 1 month ago

@bbdaus do you have any VLANs or a firewall or something set-up on your network? It must be something in your network configuration since the problem started when you made some changes on your network.

Jyx commented 1 month ago

I've noticed similar problems. I've been running my RLC-410 for a couple of years in HA. But with either recent firmware update (camera) or recent HA updates I've lost access to all of my three cameras. I tried delete one of them and re-add it, but it's not found any longer. In the Reolink app, the cameras work fine and they are still at he same IP numbers (statically assigned). I actually suspect the camera firmware changed something, if/when I find time. I'll try to see if I can downgrade the camera firmware again.

starkillerOG commented 1 month ago

@Jyx did you check if the ports are still enabled? Some firmware update close the ports.

What error do you see?

Jyx commented 1 month ago

@Jyx did you check if the ports are still enabled? Some firmware update close the ports.

@starkillerOG , you were 100% right! All ports had been closed after the firmware update. I'm back on track again, thanks!

bbdaus commented 1 month ago

@bbdaus do you have any VLANs or a firewall or something set-up on your network? It must be something in your network configuration since the problem started when you made some changes on your network.

100% Agree something changed. I just can’t figure out what. I’ve never set up a V-LAN or firewall or anything. I just bought a POE switch and plugged the cameras into it. The changes to the network relate to maybe moving a camera to another port on the switch.

bbdaus commented 1 month ago

@Jyx did you check if the ports are still enabled? Some firmware update close the ports.

@starkillerOG , you were 100% right! All ports had been closed after the firmware update. I'm back on track again, thanks!

Which ports had been closed? Where would I check this? On the camera itself?

kevinhaas commented 1 month ago

Just updated to latest HA, was like a month behind.

My RLC-823A and RLC-823A 16x both showed unavailable after updating to 2024.7.4 with the following error:

homeassistant.helpers.device_registry.DeviceIdentifierCollisionError

Nothing to do with changes on the camera end, something in this integration and/or core borked. I've made no networking, port, firmware, etc changes. These devices are not connected to the internet.

EDIT: Now If I re-add it and do the restart HA dance, I can get the entities to appear on the device. The device then showed 2 MACs and all entities went unavailable. Seen this happen a few times so far the past 5 minutes.

EDIT EDIT: Oh, it's merged my RLC-823a and RLC-823a 16x into... the same entities? Never seen anything like this before in HA. Absolute chaos for my cameras right now. It looks like I can get it working, but all the "devices" are named after one of the cameras. Entity names are still accurate.

The integration also says "2 devices" even though I have 3.

EDIT EDIT EDIT: I nuked and re-added all my cameras one last time.. and now the devices are separated. That was very wacky. One other thing I notice is that some of my entities were renamed. my camera streams were "camera_main" and "camera_sub" before. Now they are "camera_clear" and "camera_fluent" which matches reolinks own naming.

I saw some other comments that HA changed the way they handled some device id stuff. Looks like it's possibly related to this. I've been on HA nearly 3 years and never saw something like that. Almost like 2 devices were sharing some primary key/id.

Jyx commented 1 month ago

Which ports had been closed?

I re-enabled HTTPS, RTSP and ONVIF.

Where would I check this? On the camera itself?

I did it via the Reolink mobile app: settings -> "name of camera" -> Networkinfo -> Advanced -> Here are the settings.

starkillerOG commented 1 month ago

@Jyx glad it is now working again for you! I have been looking into a possibility to open up the ports automatically so this can not happen again. It is possible, but fairly difficult. Hopefully I will figure that out.

@bbdaus did you check the ports again in the mobile app, where there any closed?

@kevinhaas although totally unrelated to this issue: yes in HA 2024.7 the unique ID changed from beeing based on the MAC of the cams to the UID of the CAMs (serial number of the cams). It should have migrated withouth issues. However when you manually changed the MAC of the cams, especially when you set the MAC of 1 cam to the MAC of another one (when replacing it), this can cause the issues you described. Only solution at that point is indeed removing and re-adding the integration. The name changes have been in place for a long time, but are not applied to existing users/integrations. Seems like the issue is now resolved for you right?

If you appreciate the reolink integration and want to support its development, please consider sponsering the upstream library or purchase Reolink products through this affiliate link.

bbdaus commented 1 month ago

@starkillerOG

By ports are you referring to http and https? If so I have tried switching those on one at a time and both on. I have tried a static IP in the camera. I have tried a static IP in the camera and the router, I have tried a static IP in the router only. I have tried changing the IP to a new static IP in the router. I have tried various other combinations that can be switched on in the mobile app. I have tried this through a web interface to the camera as well. I’ve tried this on 3 cameras. I’ve tried a new login and password for the camera. I’ve tired changing the https port number away from default.

If I use the button below it logs straight into the camera after I put in the password. IMG_0670

bbdaus commented 1 month ago

I’ve also tried deleting the integration, but I think I have to delete each camera individually? I then can’t add them back as I can’t get HA to log into the camera?

starkillerOG commented 1 month ago

@bbdaus yea if the visit works, I really don't see a reason why the integration would not work.

What I suspect is that the camera's are fine and configured correctly but that the HomeAssistant device is not able to reach them while the computer/phone from wich you acces the HomeAssistant web-interface is able to reach the camera. So if HomeAssistant redirect to the camera URL it works from that computer.

I would recommend un-dowing the network changes you made as far as that is possible (old router/switches). I am guessing there is some network rule/firewall rule/VLAN seperation between the HomeAssistant device and the CAM that is not applicable between your PC/phone and the camera.

starkillerOG commented 1 month ago

Never seen such issue before...

I would also recommend enabling the RTMP, RTSP, and ONVIF port besides the HTTPS port. Just in case. (The integration should open up those ports when needed but just in case)

bbdaus commented 1 month ago

I appreciate the help. The problem I actually change anything. I have an 8 port POE switch powering the cameras and the HA yellow. All I may have done is move one or two cameras to another port. It’s been like that for 3 months before this issue.

starkillerOG commented 4 weeks ago

Is it a managed POE switch or a unmanaged one?

josefkrtil commented 4 weeks ago

I have similar problem. From version 2024.7 Reolink integration did not work - HA can not iniciate integration. Same in 2024.8.0. I run HA in docker, so when i start another docker with version 22024.6.3 integration normally works but dockers with newer versions do not. So this not probably network issue, but some change issue from 2024.6 to 2424.7

starkillerOG commented 4 weeks ago

@josefkrtil what is your exact error in the log? Also Connect call failed?

Could it be that the network setup of the docker container changed from 2024.6 to 2024.7? I don't have much docker experiance. but I know you sometimes specifically need to setup the networking of the docker.

josefkrtil commented 4 weeks ago

Error in logs: 2024-08-09 07:23:45.541 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry zahrada for reolink Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/reolink/__init__.py", line 58, in async_setup_entry await host.async_init() File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 216, in async_init await self.subscribe() File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 460, in subscribe self.register_webhook() File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 561, in register_webhook webhook.async_register( File "/usr/src/homeassistant/homeassistant/components/webhook/__init__.py", line 54, in async_register raise ValueError("Handler is already defined!") ValueError: Handler is already defined! Docker container is the same, it is clone of previous and it is only refreshed with new version. I can not upgrade to higher version, because reolink integration do not work. Debug is in the attachment. home-assistant_reolink_2024-08-09T07-24-00.191Z.log

bbdaus commented 4 weeks ago

Is it a managed POE switch or a unmanaged one?

Thanks for all the help, you were correct with HA not managing to see the cameras. I found the issue. The POE switch has a physical switch on it which isolates the ports from one another stopping them from seeing each other. I must have bumped it when working on the cables.

Now all is working fine

starkillerOG commented 3 weeks ago

@bbdaus So glad you managed to resolve this issue, you really had me scretching my head... Glad you are up and running again.

If you appreciate the reolink integration and want to support its development, please consider sponsering the upstream library or purchase Reolink products through this affiliate link

starkillerOG commented 3 weeks ago

@josefkrtil please open a new seperate issues if you are still having issues, since it is unrelated to this issue. From your log it looks like you are having a simular ID conflict as @kevinhaas was having.

What model is the "zahrada" camera, a DUO lens camera?

It looks like the "living_room", "zahrada" and "vjezd" camera's are having a ID collision. I would recommend deleting the reolink integration and setting it up fresh again. Probably something wonky with the MAC adresses that were used. Or you still have old disabled integrations of those cams (possibly with a wifi vs LAN connection)....