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.81k stars 30.06k forks source link

Reolink NVR connection issue #91294

Closed master-bobo closed 1 year ago

master-bobo commented 1 year ago

The problem

After updating my Reolink NVR to the latest firmware HA will not connect to it anymore. Possible issues I already checked are the ports on the NVR closed due to the update. I opened those up again and can connect to the web interface. Somehow HA is not getting through.

The NVR is on a VLAN different from my HA VM. It worked before the firmware update. The screenshot below is from the test I did while the NVR was connected to the same network/VLAN as the HA instance.

afbeelding

What version of Home Assistant Core has the issue?

core-2023.4.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?

Logger: homeassistant.components.reolink.config_flow
Source: components/reolink/host.py:74
Integration: Reolink IP NVR/camera (documentation, issues)
First occurred: 19:36:29 (1 occurrences)
Last logged: 19:36:29

Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/reolink/config_flow.py", line 122, in async_step_user
    await host.async_init()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 74, in async_init
    await self._api.get_host_data()
  File "/usr/local/lib/python3.10/site-packages/reolink_aio/api.py", line 1205, in get_host_data
    json_data = await self.send(body, expected_response_type="json")
  File "/usr/local/lib/python3.10/site-packages/reolink_aio/api.py", line 3258, in send
    return await self.send_chunk(body, param, expected_response_type, retry)
  File "/usr/local/lib/python3.10/site-packages/reolink_aio/api.py", line 3316, in send_chunk
    await self.login()
  File "/usr/local/lib/python3.10/site-packages/reolink_aio/api.py", line 714, in login
    json_data = await self.send(body, param, expected_response_type="json")
  File "/usr/local/lib/python3.10/site-packages/reolink_aio/api.py", line 3258, in send
    return await self.send_chunk(body, param, expected_response_type, retry)
  File "/usr/local/lib/python3.10/site-packages/reolink_aio/api.py", line 3423, in send_chunk
    raise err
  File "/usr/local/lib/python3.10/site-packages/reolink_aio/api.py", line 3343, in send_chunk
    data = await response.text(encoding="utf-8")  # returns str
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1081, in text
    await self.read()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1037, in read
    self._body = await self.content.read()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 375, in read
    block = await self.readany()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 397, in readany
    await self._wait("readany")
  File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 303, in _wait
    with self._timer:
  File "/usr/local/lib/python3.10/site-packages/aiohttp/helpers.py", line 721, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError

Additional information

No response

home-assistant[bot] commented 1 year 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.

(message by CodeOwnersMention)


reolink documentation reolink source (message by IssueLinks)

starkillerOG commented 1 year ago

@master-bobo did you change the password on the NVR? Did the IP of the NVR change?

The error message seems to indicate HA tried the password a few times and got a "wrong password" response, untill the NVR banned the HA device for a certain period (new feature in latest software, you get 3 attemps and are then banned for a time period). I would advice removing the reolink integration, waiting an hour to make sure HA is not banned by the NVR anymore. Then try to set it up again. Make sure you type the password correctly on the first attempt.

starkillerOG commented 1 year ago

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.

master-bobo commented 1 year ago

@starkillerOG I have tried everything. Created a new user with admin privilaged on the NVR with a simple password. The IP changed but that was days ago. I restarted HA and the NVR multiple times. Even rebooted the whole router setup. I also have a Reolink doorbell that doesn't go through the NVR and that one connects normally to HA. I removed it, rebooted HA and added it again to test. No problems with that one.

I could try to downgrade the firmware on the NVR.

starkillerOG commented 1 year ago

@master-bobo you could also try to turn off "illegal login lockout" in the reolink app/client. It is under settings->system->user management.

master-bobo commented 1 year ago

I turned the option off when I opened the ports on the nvr. Checked it, no change. It you need any specific logs or something I am happy to provide them.

4ndy8 commented 1 year ago

My 16channel reolink NVR no longer connects to the HA integration either. Tried a reboot of HA and reload of integration. No changes to IP or usernames etc.

HA Log file line:

Logger: reolink_aio.api Source: components/reolink/host.py:243 First occurred: 18 April 2023 at 21:32:04 (17970 occurrences) Last logged: 06:56:52

Host 10.0.2.245:443: connection error: Cannot connect to host 10.0.2.245:8000 ssl:default [Connect call failed ('10.0.2.245', 8000)].

juan11perez commented 1 year ago

@4ndy8 I had the same issue 1 week ago. I tried several things and nothing worked. I ended up doing a factory reset on the nvr and afterwards HA was able to connect. It's not to painful as camera settings are saved at the cameras. It shouldn't take you more than 15 minutes.

Nevertheless, recently the integration just drops and I cant reload it from the reload button. I need an HA restart. So it's not working properly.

starkillerOG commented 1 year ago

@4ndy8 did you check if the IP adress of the NVR perhaps changed? Are you using a static IP adress for the NVR?

In the port settings do you have HTTP(S), ONVIF, RTSP and RTMP ports all open?

starkillerOG commented 1 year ago

@juan11perez could you share a Reolink debug log from the moment when it stops working? Do you have a static IP configured for the Reolink camera/NVR? Could it be that the IP is changing causing your issues, (upon HA restart a new network scan will take place which will update the IP adress used by the Reolink integration if it changed, network scans are done at some intervall, but I don't know how long in between network scans).

juan11perez commented 1 year ago

@starkillerOG Thank you for your support. I set up debugging since you posted yesterday and as luck would have it the component has stopped disconnecting 😉

The nvr has had a fixed ip from the beginning.

I'll leave it in debug for a while and report any changes.

Thank you

Korte68 commented 1 year ago

Hi, Sometimes HA lost connection with the camera. Camera has fix IP. When HA lost the connection, from browser I can reach the camera GUI. HA restart not solve it. Removed the integration and try to re-add, but it failed. Then I restarted the camera, and after it I van add the camera to HA....please try to solve this kind of problems. Also MQTT support would be good...please consider to support it. Thank you

starkillerOG commented 1 year ago

@Korte68 could you enable debug logging for the reolink integration and share a debug log when the camera has disconnected. I can then try and figure out what is going on. If it losses connection, do all entities show as unavailable, or only the binary sensor?

I do not quite get what you mean with MQTT support, Reolink camera's dont have MQTT support. You can make it yourself with automations using state triggers for each entity and push MQTT messages. Why would you want to have MQTT?

starkillerOG commented 1 year ago

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.

Korte68 commented 1 year ago

I see camera needs to support MQTT.

Ok next time when the camera lost in HA will enable the debug. (all the entity is disconnected)

Thank you

starkillerOG @.***> ezt írta (időpont: 2023. máj. 12., P, 12:14):

@Korte68 https://github.com/Korte68 could you enable debug logging for the reolink integration and share a debug log when the camera has disconnected. I can then try and figure out what is going on. If it losses connection, do all entities show as unavailable, or only the binary sensor?

I do not quite get what you mean with MQTT support, Reolink camera's dont have MQTT support. You can make it yourself with automations using state triggers for each entity and push MQTT messages. Why would you want to have MQTT?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/91294#issuecomment-1545512646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKPJYLNHDIBGUUVDZZVDCZTXFYERTANCNFSM6AAAAAAW4BFOXM . You are receiving this because you were mentioned.Message ID: @.***>

starkillerOG commented 1 year ago

I may have found and fixed the disconnect issue, see the discussion here: https://github.com/home-assistant/core/issues/92891 Once that fix is available in HA 2023.5.3, I will let you know and ask if that resolves the problem.

starkillerOG commented 1 year ago

The fix has been merged, so will indeed be included in HA 2023.5.3. Will close this issue now, if it is not resolved by 2023.5.3, please let me know and I will re-open.