Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reolink - reauthentication required after a while #113379

Closed
postaccountgh opened this issue Mar 14, 2024 · 59 comments · Fixed by #120291
Closed

Reolink - reauthentication required after a while #113379

postaccountgh opened this issue Mar 14, 2024 · 59 comments · Fixed by #120291

Comments

@postaccountgh
Copy link

postaccountgh commented Mar 14, 2024

The problem

I have integrated a Reolink Doorbell with Reolink integration and everythig worked fine. Since 2024.3 after a while (at least 1 times a day) authenticatiion has expired and reauthentication is requred.

What version of Home Assistant Core has the issue?

2024.3

What was the last working version of Home Assistant Core?

2024.1.6

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Reolink

Link to integration documentation on our website

No response

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
Quelle: components/reolink/config_flow.py:174
Integration: Reolink IP NVR/camera (Dokumentation, Probleme)
Erstmals aufgetreten: 17:10:17 (1 Vorkommnisse)
Zuletzt protokolliert: 17:10:17

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!

Additional information

No response

@home-assistant
Copy link

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)

@mib1185
Copy link
Contributor

mib1185 commented Mar 14, 2024

please provide a bit more details, like screenshots of the issue, the diagnostics data of the integration, enable and provide the debug logging

@postaccountgh
Copy link
Author

Issue still present in 2024.3.1
Screenshot_20240316_170914_Home Assistant
Screenshot_20240316_170922_Home Assistant

@JCalvi
Copy link

JCalvi commented Mar 17, 2024

home-assistant_2024-03-17T00-29-22.031Z.log
I have the exact same issue, always the wifi doorbell of my 3 cameras. The NVR instances don't have the issue. (E1 Zoom and CX410)
I just re-authenticated with https selected to see if it helps.

The symptoms are as follows.

  1. I get a notification on Home Assistant that it needs to re-authenticate. Same as "postaccountgh" above.
  2. This is always the direct connected wifi doorbell instance.
  3. The other two camera's I have that are direct connected do not have the issue
  4. All three camera's through the NVR connected do not have the issue.
  5. I re-authenticate and it failed until I ticked the https box.
  6. The home assistant items are all still unavailable.
  7. I restart the integration (just for the wifi doorbell) and all the entities become available again.

Core log attached... You can see loss of connection at 2am, likely linked to Reolink auto reboot setting.

@JCalvi
Copy link

JCalvi commented Mar 17, 2024

It could be related to the default auto-reboot setting in Reolink?

image

@Mark-64
Copy link

Mark-64 commented Mar 17, 2024

Same issue here. I upgraded to 2024.3 yesterday and one of my 4 Reolink cameras had the issue at 2:00 AM (auto reboot on)

@garry0garry
Copy link

garry0garry commented Mar 17, 2024

Home Assistant 2024.3.1.
I have 17 cameras in integration. At night the integration reported an authentication issue for 4 cameras. Perhaps the cameras were rebooted at night (auto reboot on). After restarting Home Assistant the problem does not appear.

@jarru66
Copy link

jarru66 commented Mar 17, 2024

I had the same issue with Reolink Authentication. I'm using Reolink camera. Issue started last night.
I'm using Frigate as well and Reolink-camera is working still throw that!

Errors at log:

Logger: reolink_aio.api
Source: components/reolink/host.py:322
First occurred: 02:00:46 (2 occurrences)
Last logged: 02:00:46

Host 192.168.1.15:443: login attempt failed.
Error while unsubscribing push: Host 192.168.1.15:443: connection error: Cannot connect to host 192.168.1.15:8000 ssl:default [Connect call failed ('192.168.1.15', 8000)].

Logger: homeassistant.components.reolink
Source: helpers/update_coordinator.py:371
integration: Reolink IP NVR/camera (documentation, issues)
First occurred: 02:00:46 (1 occurrences)
Last logged: 02:00:46

Authentication failed while fetching reolink.sipoo-piha data:

Logger: homeassistant.components.reolink.config_flow
Source: components/reolink/config_flow.py:174
integration: Reolink IP NVR/camera (documentation, issues)
First occurred: 10:12:12 (1 occurrences)
Last logged: 10:12:12

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!

HA-system setup:
Core 2024.3.1
Supervisor 2024.03.0
Operating System 12.1
Frontend 20240307.0

I have the another "identical" HA setup with Reolink, which is still working without errors:
Core 2024.2.5
Supervisor 2024.03.0
Operating System 12.1
Frontend 20240207.1


I have autoreboot setup on camera at 02:00 on Sundays and it seems that Error has happened on that time.
I rebooted HA now and after that HA is NOT reporting any integration error. I also rebooted the Reolink-camera manually after that to simulate Camera Autoreboot and still NO integration errors so far.

@linuxkidd
Copy link
Contributor

linuxkidd commented Mar 19, 2024

Just confirming I have the same issue on both 2024.3 and 2024.3.1. I have two Home-Assistant locations, one has the Reolink Doorbell POE, and the other the Reolink Doorbell WiFi. I also have multiple Reolink duo cameras.

Only the Doorbells exhibit this behavior, and both the Wired POE and WiFi units are impacted.

A full-restart of Home-Assistant restores normal operation, but after some period, the 'Reconfigure' notice pops up again on both installations / both POE and WiFi units.

@supermarkert
Copy link

supermarkert commented Mar 20, 2024

Seems like a Wifi Doorbell issue. Can anyone confirm what firmware they're on? I haven't upgraded to the latest, so I'm still on v3.0.0.2555_23080700, and having the same authentication issue as above.

@linuxkidd
Copy link
Contributor

This issue occurs on both the WiFi and Wired POE version of the doorbell.

WiFi Firmware Version: v3.0.0.2033_23041300
Wired POE Firmware: v3.0.0.2555_23080702

I've just upgraded both to v3.0.0.3215 and will monitor for the reauth issue.

@JCalvi
Copy link

JCalvi commented Mar 21, 2024

Only happens on Wifi Doorbell for me (so far, I don't have any other doorbells, just an E1 and CX-410),
happened on latest v3.0.0.3215_2401262240
also happened on previous v3.0.0.2555_23080700

Does not happen on same doorbell connected via NVR.

@wljohnson05
Copy link

I figured out the issue on my end. I think I had a network problem with mine somewhere in the network. After looking into it deeper, I was seeing spanning tree blocking random ports. I ended up having to power off all my switches and other network gear for a minute or so, and then power back up. Once I did that, it cleared up, and mine has been solid since last night. I'm going to delete my previous posts as not to confuse the devs working on this issue others are having.

@pillemats
Copy link

same problem here with the WIFI Cams. POE Cams works fine

@gjgeary
Copy link

gjgeary commented Mar 23, 2024

I have a WiFi doorbell cam that is having this issue. I checked the history for the reolink doorbell cam and I can see that it started losing authentication the day I upgraded to 2024.3 (March 7). This is more anecdotal than I would like, but I see the log information below. One other thing I noticed is that when I authenticate, the first time it has an unexpected error. Someone noted that if you enable https then try again, then it authenticates. I find that if I just submit again without changing anything it authenticates. Then if you reload it works OK for awhile. Sometimes just hours.

If there is any other information I can provide, please let me know.

Thanks

log Errors:
2024-03-23 10:31:01.460 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 10.212.1.143:443: connection error: Cannot connect to host 10.212.1.143:8999 ssl:default [Connect call failed ('10.212.1.143', 8999)].
2024-03-23 10:31:01.462 ERROR (MainThread) [homeassistant.components.reolink] Error fetching reolink.Front Doorbell data: Host 10.212.1.143:443: connection error: Cannot connect to host 10.212.1.143:443 ssl:default [Connect call failed ('10.212.1.143', 443)]
2024-03-23 10:32:39.332 INFO (MainThread) [homeassistant.components.reolink] Fetching reolink.Front Doorbell data recovered

@ChrisODonnell25
Copy link

ChrisODonnell25 commented Mar 24, 2024

I'm experiencing the same issue as other people have described, Reolink connection to my POE camera fails until I re-authenticate.

When I first try to authenticate there is an unexpected error and then, whether or not I have https ticked, re-submitting works. Issue only started as of updating to 2024.3.

Note: Issue does not appear to be related to the maintenance restart on Sunday at 2am as it can occur on any day.

I have tried:
simply re-authing
restarting HA
deleting the integration, restarting, re-adding the integration, restarting
To no avail, the integration always fails again within 24 hours.

Here are some logs:

2024-03-21 20:19:21.118 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 192.168.1.9:443: connection timeout exception.
2024-03-21 20:19:28.334 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing long_poll: Host 192.168.1.9:443: connection error: Cannot connect to host 192.168.1.9:8000 ssl:default [Connect call failed ('192.168.1.9', 8000)].
2024-03-21 20:19:28.335 ERROR (MainThread) [homeassistant.components.reolink] Error fetching reolink.Driveway camera data: Host 192.168.1.9:443: Timeout error:
2024-03-21 20:19:28.339 ERROR (MainThread) [homeassistant.components.reolink.host] Error while requesting ONVIF pull point: Failed to request pull point message: Host 192.168.1.9:443: connection error: Server disconnected.
2024-03-21 21:31:03.964 ERROR (MainThread) [homeassistant.components.reolink.host] Error while requesting ONVIF pull point: Failed to request pull point message: Host 192.168.1.9:443: subscription request got a response with wrong HTTP status 405: Method Not Allowed
2024-03-21 21:33:25.651 ERROR (MainThread) [homeassistant.components.reolink] Error fetching reolink.Driveway camera data: Host 192.168.1.9:443: Timeout error:
2024-03-21 22:46:52.344 ERROR (MainThread) [reolink_aio.api] Host 192.168.1.9:443: login attempt failed.
2024-03-21 22:46:52.442 ERROR (MainThread) [homeassistant.components.reolink] Authentication failed while fetching reolink.Driveway camera data:
2024-03-21 22:46:52.446 ERROR (MainThread) [homeassistant.components.reolink.host] Error while requesting ONVIF pull point: Failed to request pull point message: Host 192.168.1.9:443: connection error: Server disconnected.

Also this the next morning (probably due to the integration failing but thought I'd include it just in case):

2024-03-22 09:01:30.982 ERROR (MainThread) [homeassistant.components.reolink.config_flow] 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!

@linuxkidd
Copy link
Contributor

I had almost thought that the upgrade to Doorbell firmware v3.0.0.3215 had resolved this issue.. alas, I only needed to wait a bit longer. This is from my POE doorbell:

Home Assistant Started

2024-03-22 15:56:05.810

Doorbell Reconfigure notice hit

2024-03-24 10:25:04.205 ERROR (MainThread) [reolink_aio.api] Host 172.18.123.50:443: login attempt failed.
2024-03-24 10:25:04.291 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 172.18.123.50:443: subscription request got a response with wrong HTTP status 400: Bad Request
2024-03-24 10:25:04.292 ERROR (MainThread) [homeassistant.components.reolink] Authentication failed while fetching reolink.Astro Doorbell data: 

Unfortunately, this is all the data that is present in the logs, despite the data: ending there leading one to think there should be more.

@JCalvi
Copy link

JCalvi commented Mar 25, 2024

Happened again last night about a week after last one. Reboot turned off this time so not related to that.

Logger: reolink_aio.api
Source: components/reolink/host.py:322
First occurred: March 23, 2024 at 9:24:47 PM (5 occurrences)
Last logged: 3:21:42 AM

Error while unsubscribing push: Host 192.168.1.221:443: connection error: Cannot connect to host 192.168.1.221:8000 ssl:default [Connect call failed ('192.168.1.221', 8000)].
Error while unsubscribing push: Host 192.168.1.221:443: subscription request got a response with wrong HTTP status 400: Bad Request
Host 192.168.1.221:443: login attempt failed.
Logger: homeassistant.components.reolink
Source: helpers/update_coordinator.py:371
integration: Reolink IP NVR/camera (documentation, issues)
First occurred: 3:21:42 AM (1 occurrences)
Last logged: 3:21:42 AM

Authentication failed while fetching reolink.Video Doorbell data:

Note 1: As others have stated resubmitting authentication fails on first attempt, then works on second attempt (whether https is selected or not does not matter).

Note 2: I have 1 Wifi Doorbell but two devices in Home Assistant. One Direct and One through a RL36 NVR. The NVR one has never failed, only the direct connection wants weekly re authentications.

Note 3: Re-authentication still leaves all entities unavailable. I need to also reload the device through the integration to get the entities reporting again.

@ChrisODonnell25
Copy link

ChrisODonnell25 commented Mar 26, 2024

Happened to me again last night, 5 days after last occurrence.

Reolink POE Camera
HA Core 2024.3

I had debugging enabled this time so will dump those logs at the end. From the logs, this is the order of operations:

A data Request is sent
Error: 405 Method Not Allowed
An Unsubscribe Request is sent
Unsubscribe Response is successful
Couple of requests that time out
Another successful unsubscribe request
Then, ~1.5 hours later, a Logout request is sent, which fails with message: "please login first"
A login request is sent which is successful

So this is interesting, it was logged in to the camera again, but the integration was not working and HA was telling me to re-authenticate. Instead of trying to re-auth, I just reloaded the integration and now it's working, I can view the camera feed directly and on my dashboards BUT HA is still prompting me to re-auth:

image

image

Here is the dump of the debugging logs, note I've included the call/response to the reolink hardware endpoint because my particular device's hardware is not listed in the response, which I don't think is related to this issue but more info is better than less:

2024-03-26 01:04:50.015 DEBUG (MainThread) [reolink_aio.api] Reolink Driveway camera requesting ONVIF pull point message
2024-03-26 01:04:50.015 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443: subscription request data:

    <soap:Envelope xmlns:add="http://www.w3.org/2005/08/addressing" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsdl="http://www.onvif.org/ver10/events/wsdl">
        <soap:Header>
            <add:Action>http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesRequest</add:Action>
            <add:To>http://192.168.1.9:8000/onvif/PullSubManager?Idx=00_0</add:To>
            <wsse:Security soap:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:UsernameToken wsu:Id="<UsernameToken>">
                    <wsse:Username>admin</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"><digest></wsse:Password>
                    <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"><binary></wsse:Nonce>
                    <wsu:Created>2024-03-25T14:04:50.000Z</wsu:Created>
                </wsse:UsernameToken>
            </wsse:Security>
        </soap:Header>
        <soap:Body>
            <wsdl:PullMessages>
                <wsdl:Timeout>PT5M</wsdl:Timeout>
                <wsdl:MessageLimit>100</wsdl:MessageLimit>
            </wsdl:PullMessages>
        </soap:Body>
    </soap:Envelope>

2024-03-26 01:04:55.935 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443: subscription got response status: 405. Payload:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://www.onvif.org/ver10/actionengine/wsdl" xmlns:ns10="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:ns11="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:ns12="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:ns13="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:ns14="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:ns3="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:ns4="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:ns5="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:ns6="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:ns7="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:ns8="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:ns9="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:tad="http://www.onvif.org/ver10/analyticsdevice/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tls="http://www.onvif.org/ver10/display/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xmime5="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<SOAP-ENV:Body>
		<SOAP-ENV:Fault>
			<faultcode>SOAP-ENV:Client</faultcode>
			<faultstring>HTTP Error: 405 Method Not Allowed</faultstring>
		</SOAP-ENV:Fault>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

2024-03-26 01:04:55.935 ERROR (MainThread) [homeassistant.components.reolink.host] Error while requesting ONVIF pull point: Failed to request pull point message: Host 192.168.1.9:443: subscription request got a response with wrong HTTP status 405: Method Not Allowed
2024-03-26 01:04:55.936 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443: subscription request data:

    <soap:Envelope xmlns:add="http://www.w3.org/2005/08/addressing" xmlns:b="http://docs.oasis-open.org/wsn/b-2" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
        <soap:Header>
            <add:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/UnsubscribeRequest</add:Action>
            <add:To>http://192.168.1.9:8000/onvif/PullSubManager?Idx=00_0</add:To>
            <wsse:Security soap:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:UsernameToken wsu:Id="<UsernameToken>">
                    <wsse:Username>admin</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"><digest></wsse:Password>
                    <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"><binary></wsse:Nonce>
                    <wsu:Created>2024-03-25T14:04:55.000Z</wsu:Created>
                </wsse:UsernameToken>
            </wsse:Security>
        </soap:Header>
        <soap:Body>
            <b:Unsubscribe/>
        </soap:Body>
    </soap:Envelope>

2024-03-26 01:05:05.581 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443: get_states update cmd list:

['GetIrLights', 'GetEnc', 'GetEmail', 'GetFtp', 'GetPush', 'GetRec', 'GetAudioCfg', 'GetMdAlarm', 'GetAiAlarm', 'GetIsp']

2024-03-26 01:05:05.581 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request params =

{'token': '<token>'}

2024-03-26 01:05:05.581 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request body =

[{'cmd': 'GetEnc', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetIsp', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetMdState', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAiState', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetIrLights', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAudioCfg', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetEmailV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetPushV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetFtpV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetRecV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetMdAlarm', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAiAlarm', 'action': 0, 'param': {'channel': 0, 'ai_type': 'people'}}, {'cmd': 'GetAiAlarm', 'action': 0, 'param': {'channel': 0, 'ai_type': 'vehicle'}}]

2024-03-26 01:05:11.119 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443: subscription got response status: 200. Payload:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://www.onvif.org/ver10/actionengine/wsdl" xmlns:ns10="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:ns11="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:ns12="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:ns13="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:ns14="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:ns3="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:ns4="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:ns5="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:ns6="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:ns7="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:ns8="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:ns9="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:tad="http://www.onvif.org/ver10/analyticsdevice/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tls="http://www.onvif.org/ver10/display/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xmime5="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<SOAP-ENV:Header>
		<wsa5:To SOAP-ENV:mustUnderstand="1">http://192.168.1.9:8000/onvif/PullSubManager?Idx=00_0</wsa5:To>
		<wsa5:Action SOAP-ENV:mustUnderstand="1">http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/UnsubscribeRequest</wsa5:Action>
	</SOAP-ENV:Header>
	<SOAP-ENV:Body>
		<wsnt:UnsubscribeResponse/>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

2024-03-26 01:05:42.118 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443: connection timeout, trying again.
2024-03-26 01:05:42.118 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request params =

{'token': '<token>'}

2024-03-26 01:05:42.118 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request body =

[{'cmd': 'GetEnc', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetIsp', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetMdState', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAiState', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetIrLights', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAudioCfg', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetEmailV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetPushV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetFtpV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetRecV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetMdAlarm', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAiAlarm', 'action': 0, 'param': {'channel': 0, 'ai_type': 'people'}}, {'cmd': 'GetAiAlarm', 'action': 0, 'param': {'channel': 0, 'ai_type': 'vehicle'}}]

2024-03-26 01:06:13.118 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443: connection timeout, trying again.
2024-03-26 01:06:13.118 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request params =

{'token': '<token>'}

2024-03-26 01:06:13.118 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request body =

[{'cmd': 'GetEnc', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetIsp', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetMdState', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAiState', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetIrLights', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAudioCfg', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetEmailV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetPushV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetFtpV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetRecV20', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetMdAlarm', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAiAlarm', 'action': 0, 'param': {'channel': 0, 'ai_type': 'people'}}, {'cmd': 'GetAiAlarm', 'action': 0, 'param': {'channel': 0, 'ai_type': 'vehicle'}}]

2024-03-26 01:06:28.705 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Response status = 200, content-type = (text/html).
2024-03-26 01:06:28.705 DEBUG (MainThread) [reolink_aio.api.data] Driveway camera/192.168.1.9:443::send() HTTP Response data:

[
   {
      "cmd" : "Unknown",
      "code" : 1,
      "error" : {
         "detail" : "please login first",
         "rspCode" : -6
      }
   }
]

2024-03-26 01:06:28.705 ERROR (MainThread) [reolink_aio.api] Host 192.168.1.9:443: login attempt failed.
2024-03-26 01:06:28.706 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443: subscription request data:

    <soap:Envelope xmlns:add="http://www.w3.org/2005/08/addressing" xmlns:b="http://docs.oasis-open.org/wsn/b-2" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
        <soap:Header>
            <add:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/UnsubscribeRequest</add:Action>
            <add:To>http://192.168.1.9:8000/onvif/Notification?Idx=00_0</add:To>
            <wsse:Security soap:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:UsernameToken wsu:Id="<UsernameToken>">
                    <wsse:Username>admin</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"><digest></wsse:Password>
                    <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"><binary></wsse:Nonce>
                    <wsu:Created>2024-03-25T14:06:28.000Z</wsu:Created>
                </wsse:UsernameToken>
            </wsse:Security>
        </soap:Header>
        <soap:Body>
            <b:Unsubscribe/>
        </soap:Body>
    </soap:Envelope>

2024-03-26 01:06:28.771 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443: subscription got response status: 200. Payload:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://www.onvif.org/ver10/actionengine/wsdl" xmlns:ns10="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:ns11="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:ns12="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:ns13="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:ns14="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:ns3="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:ns4="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:ns5="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:ns6="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:ns7="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:ns8="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:ns9="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:tad="http://www.onvif.org/ver10/analyticsdevice/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tls="http://www.onvif.org/ver10/display/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xmime5="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header>
        <wsa5:To SOAP-ENV:mustUnderstand="1">http://192.168.1.9:8000/onvif/Notification?Idx=00_0</wsa5:To>
        <wsa5:Action SOAP-ENV:mustUnderstand="1">http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/UnsubscribeRequest</wsa5:Action>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <wsnt:UnsubscribeResponse/>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

2024-03-26 01:06:28.773 ERROR (MainThread) [homeassistant.components.reolink] Authentication failed while fetching reolink.Driveway camera data:
2024-03-26 01:06:28.773 DEBUG (MainThread) [homeassistant.components.reolink] Finished fetching reolink.Driveway camera data in 83.192 seconds (success: False)
2024-03-26 03:31:00.194 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request params =

{'cmd': 'Logout', 'token': '<token>'}

2024-03-26 03:31:00.194 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request body =

[{'cmd': 'Logout', 'action': 0, 'param': {}}]

2024-03-26 03:31:00.299 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Response status = 200, content-type = (text/html).
2024-03-26 03:31:00.299 DEBUG (MainThread) [reolink_aio.api.data] Driveway camera/192.168.1.9:443::send() HTTP Response data:

[
   {
      "cmd" : "Logout",
      "code" : 1,
      "error" : {
         "detail" : "please login first",
         "rspCode" : -6
      }
   }
]

2024-03-26 03:31:00.299 DEBUG (MainThread) [reolink_aio.api] Host 192.168.1.9:443, trying to login with user admin...
2024-03-26 03:31:00.299 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request params =

{'cmd': 'Login', 'token': 'null'}

2024-03-26 03:31:00.299 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request body =

[{'cmd': 'Login', 'action': 0, 'param': {'User': {'userName': 'admin', 'password': '<password>'}}}]

2024-03-26 03:31:00.370 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Response status = 200, content-type = (text/html).
2024-03-26 03:31:00.370 DEBUG (MainThread) [reolink_aio.api.data] Driveway camera/192.168.1.9:443::send() HTTP Response data:

[
   {
      "cmd" : "Login",
      "code" : 0,
      "value" : {
         "Token" : {
            "leaseTime" : 3600,
            "name" : "<token>"
         }
      }
   }
]

2024-03-26 03:31:00.370 DEBUG (MainThread) [reolink_aio.api] Got login response from 192.168.1.9:443:

[{'cmd': 'Login', 'code': 0, 'value': {'Token': {'leaseTime': 3600, 'name': '<token>'}}}]

2024-03-26 03:31:00.370 DEBUG (MainThread) [reolink_aio.api] Logged in at host 192.168.1.9:443. Leasetime 26-03-2024 04:31, token
2024-03-26 03:31:00.371 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request params =

{'token': '<token>'}

2024-03-26 03:31:00.371 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Request body =

[{'cmd': 'GetDevInfo', 'action': 0, 'param': {}}, {'cmd': 'CheckFirmware'}]

2024-03-26 03:31:01.921 DEBUG (MainThread) [reolink_aio.api] Driveway camera/192.168.1.9:443::send() HTTP Response status = 200, content-type = (text/html).
2024-03-26 03:31:01.921 DEBUG (MainThread) [reolink_aio.api.data] Driveway camera/192.168.1.9:443::send() HTTP Response data:

[
   {
      "cmd" : "GetDevInfo",
      "code" : 0,
      "value" : {
         "DevInfo" : {
            "B485" : 0,
            "IOInputNum" : 0,
            "IOOutputNum" : 0,
            "audioNum" : 1,
            "buildDay" : "build 22010700",
            "cfgVer" : "v3.1.0.0",
            "channelNum" : 1,
            "detail" : "IPC_523128M5MP_V2S10E1W01100000",
            "diskNum" : 1,
            "exactType" : "IPC",
            "firmVer" : "v3.1.0.801_22010700",
            "frameworkVer" : 1,
            "hardVer" : "IPC_523128M5MP_V2",
            "model" : "RLC-510A",
            "name" : "Driveway camera",
            "pakSuffix" : "pak,paks",
            "serial" : "00000000983040",
            "type" : "IPC",
            "wifi" : 0
         }
      }
   },
   {
      "cmd" : "CheckFirmware",
      "code" : 0,
      "value" : {
         "newFirmware" : 0
      }
   }
]

2024-03-26 03:31:01.921 DEBUG (MainThread) [reolink_aio.api] Driveway camera requesting reolink.com 'https://reolink.com/wp-json/reo-v2/download/hardware-version/selection-list'
2024-03-26 03:31:02.782 DEBUG (MainThread) [reolink_aio.api.data] Driveway camera reolink.com response:

{
    "data": [{"dlProduct": {"id": 198, "title": "RLN12W"}, "id": 333, "title": "NVR_NNT3NA58W_E"},{"dlProduct": {"id": 198, "title": "RLN12W"}, "id": 332, "title": "NVR_NNT3NA58W_U"},{"dlProduct": {"id": 194, "title": "B500W"}, "id": 331, "title": "IPC_MS1NO25MP"},{"dlProduct": {"id": 196, "title": "B800W"}, "id": 330, "title": "IPC_MS2NO28MP"},{"dlProduct": {"id": 193, "title": "NVS16"}, "id": 329, "title": "N6MB01"},{"dlProduct": {"id": 192, "title": "NVS8"}, "id": 328, "title": "N7MB01"},{"dlProduct": {"id": 191, "title": "RLC-833A"}, "id": 327, "title": "IPC_523D88MP"},{"dlProduct": {"id": 6, "title": "RLC-520A"}, "id": 326, "title": "IPC_MS1NA45MP"},{"dlProduct": {"id": 1, "title": "RLC-510A"}, "id": 325, "title": "IPC_MS1NA45MP"},{"dlProduct": {"id": 163, "title": "RLC-510WA"}, "id": 324, "title": "IPC_MS1NA45MP"},{"dlProduct": {"id": 190, "title": "E1 Outdoor PoE"}, "id": 323, "title": "IPC_560SD88MP"},{"dlProduct": {"id": 76, "title": "E1"}, "id": 322, "title": "IPC_566SD53MP"},{"dlProduct": {"id": 81, "title": "E1 Pro"}, "id": 321, "title": "IPC_566SD54MP"},{"dlProduct": {"id": 123, "title": "E1 Outdoor"}, "id": 320, "title": "IPC_566SD85MP"},{"dlProduct": {"id": 188, "title": "RLC-410-5MP"}, "id": 319, "title": "IPC_51516M5M"},{"dlProduct": {"id": 188, "title": "RLC-410-5MP"}, "id": 318, "title": "IPC_515B16M5M"},{"dlProduct": {"id": 187, "title": "RLC-81PA"}, "id": 317, "title": "IPC_56064M8MP"},{"dlProduct": {"id": 157, "title": "B800"}, "id": 316, "title": "IPC_5158M8M_V2"},{"dlProduct": {"id": 162, "title": "D800"}, "id": 315, "title": "IPC_5158M8M_V2"},{"dlProduct": {"id": 160, "title": "B500"}, "id": 314, "title": "IPC_515B8M5M_V2"},{"dlProduct": {"id": 161, "title": "D500"}, "id": 313, "title": "IPC_515B8M5M_V2"},{"dlProduct": {"id": 186, "title": "CX410"}, "id": 312, "title": "IPC_NT1NA44MP"},{"dlProduct": {"id": 9, "title": "RLC-810A"}, "id": 309, "title": "IPC_56064M8MP"},{"dlProduct": {"id": 18, "title": "RLC-820A"}, "id": 310, "title": "IPC_56064M8MP"},{"dlProduct": {"id": 185, "title": "E1 Outdoor Pro"}, "id": 311, "title": "IPC_560SD88MP"},{"dlProduct": {"id": 184, "title": "RLC-830A"}, "id": 308, "title": "IPC_560SD78MP"},{"dlProduct": {"id": 182, "title": "RLC-1212A"}, "id": 306, "title": "IPC_523B18128M12MP"},{"dlProduct": {"id": 183, "title": "RLC-1224A"}, "id": 307, "title": "IPC_523D8128M12MP"},{"dlProduct": {"id": 91, "title": "E1 Zoom"}, "id": 304, "title": "IPC_566SD65MP"},{"dlProduct": {"id": 91, "title": "E1 Zoom"}, "id": 303, "title": "IPC_566SD664M5MP"},{"dlProduct": {"id": 180, "title": "Reolink Video Doorbell PoE"}, "id": 302, "title": "DB_566128M5MP_P"},{"dlProduct": {"id": 181, "title": "Reolink Video Doorbell WiFi"}, "id": 301, "title": "DB_566128M5MP_W"},{"dlProduct": {"id": 179, "title": "Reolink Duo Floodlight WiFi"}, "id": 300, "title": "IPC_529B17B8MP"},{"dlProduct": {"id": 178, "title": "Reolink Duo Floodlight PoE"}, "id": 299, "title": "IPC_529B17B8MP"},{"dlProduct": {"id": 177, "title": "D1200"}, "id": 298, "title": "IPC_52316M12MP"},{"dlProduct": {"id": 176, "title": "B1200"}, "id": 297, "title": "IPC_52316M12MP"},{"dlProduct": {"id": 175, "title": "RLC-823A 16X"}, "id": 296, "title": "IPC_523SD10"},{"dlProduct": {"id": 174, "title": "Reolink TrackMix WiFi"}, "id": 295, "title": "IPC_529SD78MP"},{"dlProduct": {"id": 173, "title": "Reolink TrackMix PoE"}, "id": 294, "title": "IPC_529SD78MP"},{"dlProduct": {"id": 33, "title": "RLN8-410 (NVR)"}, "id": 292, "title": "N7MB01"},{"dlProduct": {"id": 170, "title": "Reolink Duo WiFi"}, "id": 290, "title": "IPC_528B174MP"},{"dlProduct": {"id": 171, "title": "Reolink Duo PoE"}, "id": 289, "title": "IPC_528B174MP"},{"dlProduct": {"id": 169, "title": "Reolink Duo 2 WiFi"}, "id": 288, "title": "IPC_529B17B8MP"},{"dlProduct": {"id": 168, "title": "Reolink Duo 2 POE"}, "id": 287, "title": "IPC_529B17B8MP"},{"dlProduct": {"id": 167, "title": "RLN36"}, "id": 286, "title": "N5MB01"},{"dlProduct": {"id": 51, "title": "RLN16-410 (NVR)"}, "id": 285, "title": "N6MB01"},{"dlProduct": {"id": 76, "title": "E1"}, "id": 109, "title": "IPC_517SD5"},{"dlProduct": {"id": 52, "title": "RLC-410"}, "id": 79, "title": "IPC_51316M"},{"dlProduct": {"id": 72, "title": "RLC-422W"}, "id": 105, "title": "IPC_51516M5M"},{"dlProduct": {"id": 73, "title": "RLC-511"}, "id": 106, "title": "IPC_51516M5M"},{"dlProduct": {"id": 69, "title": "RLC-511W"}, "id": 102, "title": "IPC_51516M5M"},{"dlProduct": {"id": 62, "title": "RLC-520"}, "id": 95, "title": "IPC_51516M5M"},{"dlProduct": {"id": 94, "title": "RLC-410W"}, "id": 133, "title": "IPC_515B16M5M"},{"dlProduct": {"id": 94, "title": "RLC-410W"}, "id": 274, "title": "IPC_51316M"},{"dlProduct": {"id": 165, "title": "RLC-410W-5MP"}, "id": 283, "title": "IPC_51516M5M"},{"dlProduct": {"id": 165, "title": "RLC-410W-5MP"}, "id": 282, "title": "IPC_515B16M5M"},{"dlProduct": {"id": 159, "title": "D400"}, "id": 281, "title": "IPC_5128M"},{"dlProduct": {"id": 94, "title": "RLC-410W"}, "id": 277, "title": "IPC_51516M5M"},{"dlProduct": {"id": 163, "title": "RLC-510WA"}, "id": 273, "title": "IPC_523128M5MP"},{"dlProduct": {"id": 162, "title": "D800"}, "id": 272, "title": "IPC_5158MP8M"},{"dlProduct": {"id": 157, "title": "B800"}, "id": 271, "title": "IPC_5158MP8M"},{"dlProduct": {"id": 158, "title": "B400"}, "id": 270, "title": "IPC_5128M"},{"dlProduct": {"id": 161, "title": "D500"}, "id": 268, "title": "IPC_5158M5M"},{"dlProduct": {"id": 161, "title": "D500"}, "id": 267, "title": "IPC_515B8M5M"},{"dlProduct": {"id": 160, "title": "B500"}, "id": 266, "title": "IPC_5158M5M"},{"dlProduct": {"id": 160, "title": "B500"}, "id": 265, "title": "IPC_515B8M5M"},{"dlProduct": {"id": 6, "title": "RLC-520A"}, "id": 6, "title": "IPC_523128M5MP"},{"dlProduct": {"id": 9, "title": "RLC-810A"}, "id": 9, "title": "IPC_523128M8MP"},{"dlProduct": {"id": 18, "title": "RLC-820A"}, "id": 18, "title": "IPC_523128M8MP"},{"dlProduct": {"id": 33, "title": "RLN8-410 (NVR)"}, "id": 33, "title": "H3MB02"},{"dlProduct": {"id": 33, "title": "RLN8-410 (NVR)"}, "id": 43, "title": "H3MB16"},{"dlProduct": {"id": 52, "title": "RLC-410"}, "id": 82, "title": "IPC_51516M5M"},{"dlProduct": {"id": 55, "title": "RLC-420"}, "id": 85, "title": "IPC_51316M"},{"dlProduct": {"id": 58, "title": "RLC-422"}, "id": 88, "title": "IPC-51516M"},{"dlProduct": {"id": 55, "title": "RLC-420"}, "id": 91, "title": "IPC_51516M5M"},{"dlProduct": {"id": 65, "title": "RLC-522"}, "id": 98, "title": "IPC_51516M5M"},{"dlProduct": {"id": 81, "title": "E1 Pro"}, "id": 114, "title": "IPC_513SD5"},{"dlProduct": {"id": 91, "title": "E1 Zoom"}, "id": 127, "title": "IPC_515BSD6"},{"dlProduct": {"id": 52, "title": "RLC-410"}, "id": 130, "title": "IPC-515B16M5M"},{"dlProduct": {"id": 62, "title": "RLC-520"}, "id": 138, "title": "IPC_515B16M5M"},{"dlProduct": {"id": 55, "title": "RLC-420"}, "id": 141, "title": "IPC_515B16M5M"},{"dlProduct": {"id": 97, "title": "RLC-423"}, "id": 144, "title": "IPC_51516M5M"},{"dlProduct": {"id": 111, "title": "RLC-1210A"}, "id": 175, "title": "IPC_523128M12MP"},{"dlProduct": {"id": 114, "title": "RLC-1220A"}, "id": 178, "title": "IPC_523128M12MP"},{"dlProduct": {"id": 33, "title": "RLN8-410 (NVR)"}, "id": 231, "title": "N2MB02 or H3MB18"},{"dlProduct": {"id": 51, "title": "RLN16-410 (NVR)"}, "id": 196, "title": "H3MB18 "},{"dlProduct": {"id": 120, "title": "RLC-822A"}, "id": 197, "title": "IPC_523128M8MP"},{"dlProduct": {"id": 91, "title": "E1 Zoom"}, "id": 205, "title": "IPC_515SD6"},{"dlProduct": {"id": 33, "title": "RLN8-410 (NVR)"}, "id": 208, "title": "N3MB01"},{"dlProduct": {"id": 133, "title": "RLC-511WA"}, "id": 214, "title": "IPC_523128M5MP"},{"dlProduct": {"id": 1, "title": "RLC-510A"}, "id": 220, "title": "IPC_523128M5MP"},{"dlProduct": {"id": 136, "title": "RLC-811A"}, "id": 228, "title": " IPC_523128M8MP"},{"dlProduct": {"id": 81, "title": "E1 Pro"}, "id": 232, "title": "IPC_515SD5"},{"dlProduct": {"id": 139, "title": "RLC-812A"}, "id": 239, "title": "IPC_523B188MP"},{"dlProduct": {"id": 142, "title": "RLC-824A"}, "id": 242, "title": "IPC_523D88MP"},{"dlProduct": {"id": 145, "title": "RLC-842A"}, "id": 245, "title": "IPC_523D98MP"},{"dlProduct": {"id": 148, "title": "RLC-542WA"}, "id": 248, "title": "IPC_523D95MP"},{"dlProduct": {"id": 151, "title": "RLC-823A"}, "id": 251, "title": "IPC_523128M8MP"},{"dlProduct": {"id": 154, "title": "RLC-523WA"}, "id": 254, "title": "IPC_523128M5MP"},{"dlProduct": {"id": 94, "title": "RLC-410W"}, "id": 260, "title": "IPC_30K128M4MP"},{"dlProduct": {"id": 51, "title": "RLN16-410 (NVR)"}, "id": 78, "title": "H3MB02"}],
    "result": {
        "code": 0,
        "msg": "ok"
    }
}

2024-03-26 03:31:02.783 DEBUG (MainThread) [reolink_aio.api] Could not find model 'RLC-510A' hardware 'IPC_523128M5MP_V2' in list from reolink.com
2024-03-26 03:31:02.783 DEBUG (MainThread) [homeassistant.components.reolink] Finished fetching reolink.Driveway camera.firmware data in 2.589 seconds (success: True)

@capokrzywa
Copy link

Jumping in to just say I also have been experiencing this issue quite frequently. Here's my reddit post with screenshots and more detail on what's been happening. https://www.reddit.com/r/homeassistant/comments/1bldnqo/reolink_integration_authentication_expired_for/

@gjgeary
Copy link

gjgeary commented Apr 4, 2024

Just updated to HAOS 2024.4 and the problem remains.

@danieljclark
Copy link

danieljclark commented Apr 4, 2024

I've been having this issue for the past month as well, however I may have 'fixed' my problem in so far as I haven't had another auth issue in the week or so since I made a change.

In my case I have the doorbell being accessed in several ways: manual web page, phone app, frigate (docker) and home assistant integration.

Previously I had one default admin account and just used the same credential for each. My theory is that they were conflicting and crashing the doorbell. Unsure if this is a fundamental problem or related to timing and the proximity of multiple login attempts.

I have created two new user accounts (via system > user management) on webUI for frigate and home assistant so I now have three credentials in total.

No auth issues since, which may just be coincidence as it hasn't been that long yet but if doing this helps others it's reasonable evidence that we're on to something.

@supermarkert
Copy link

supermarkert commented Apr 4, 2024

Well, that fix doesn't seem to apply to me:
I have only 2 users defined in each camera: the default "Admin" account, and a custom "IOT" account.
The Admin account is only used for Home Assistant, and the Reolink app. I am the only App user. HA integration requires the Admin user, per the docs.
The IOT account is only used for Frigate.

This is the way it's been for weeks and I still get the Authentication issue ~ every day, and it only started a few weeks ago (same as everyone else).

Edit: And only my Wifi Doorbell exhibits the issue. My RLC-822A has not had the issue once. (I use the same user/pass on each).

@apersaud88
Copy link

Same issue. Following

@J-o-h-n-M
Copy link

J-o-h-n-M commented Apr 7, 2024

I have the same issue. I have 8 wifi cameras. And they all seem to have this issue at random times.

I do reboot my cameras every day and I reboot my wifi every week. At the moment it is almost every day that at least one camera needs reauthentication.

The strange thing is that in the first screen that popsup, I press submit, that always fails. Then I enter my password on the second screen and that works fine.

This was in the log:

Log details (ERROR)
Logger: homeassistant.components.reolink.config_flow
Source: components/reolink/config_flow.py:184
integration: Reolink IP NVR/camera ([documentation](https://www.home-assistant.io/integrations/reolink), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+reolink%22))
First occurred: 08:16:45 (2 occurrences)
Last logged: 08:17:08

Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/reolink/config_flow.py", line 184, in async_step_user
    await host.async_init()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 174, in async_init
    await self.subscribe()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 402, in subscribe
    self.register_webhook()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 503, 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!

If I look at the logs, the authentication issue does start after the reboots. First I get a few errors regarding bad gateway (sorry for the messy code, but thats how it appears in the log):

Logger: reolink_aio.api
Source: components/reolink/number.py:500
First occurred: 02:00:21 (9 occurrences)
Last logged: 02:00:25

Error while unsubscribing push: Host 192.168.178.34:443: connection error: Cannot connect to host 192.168.178.34:8000 ssl:default [Connect call failed ('192.168.178.34', 8000)].
Host 192.168.178.34:443: API error: API returned HTTP status ERROR code 502/Bad Gateway.
Error while logging out: API returned HTTP status ERROR code 502/Bad Gateway
Host 192.168.178.34:443: unknown exception "API error during login of host 192.168.178.34:443: API returned HTTP status ERROR code 502/Bad Gateway" occurred, traceback: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 927, in login json_data = await self.send(body, param, expected_response_type="json") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4065, in send return await self.send_chunk(body, param, expected_response_type, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4326, in send_chunk raise err File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4209, in send_chunk return await self.send(body, param, expected_response_type, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4065, in send return await self.send_chunk(body, param, expected_response_type, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4326, in send_chunk raise err File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4209, in send_chunk return await self.send(body, param, expected_response_type, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4065, in send return await self.send_chunk(body, param, expected_response_type, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4326, in send_chunk raise err File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4213, in send_chunk raise ApiError(f"API returned HTTP status ERROR code {response.status}/{response.reason}") reolink_aio.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4209, in send_chunk return await self.send(body, param, expected_response_type, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4065, in send return await self.send_chunk(body, param, expected_response_type, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4129, in send_chunk await self.login() File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 929, in login raise LoginError(f"API error during login of host {self._host}:{self._port}: {str(err)}") from err reolink_aio.exceptions.LoginError: API error during login of host 192.168.178.34:443: API returned HTTP status ERROR code 502/Bad Gateway

then i get

Logger: homeassistant.components.reolink
Source: helpers/update_coordinator.py:368
integration: Reolink IP NVR/camera (documentation, issues)
First occurred: 02:00:37 (2 occurrences)
Last logged: 02:01:08

Authentication failed while fetching reolink.Woonkamer data:
Authentication failed while fetching reolink.Achter data:

@permster
Copy link

permster commented Apr 7, 2024

The strange thing is that in the first screen that popsup, I press submit, that always fails. Then I enter my password on the second screen and that works fine.

Same thing I've noticed except you don't need to reenter your password at all. Just submit, it will error, then submit on the second prompt and it works with the saved password.

@capokrzywa
Copy link

capokrzywa commented Apr 8, 2024

Same thing I've noticed except you don't need to reenter your password at all. Just submit, it will error, then submit on the second prompt and it works with the saved password.

Yep, that's how I've been going about this for over a month or so now. Do we know if there's someone from the Reolink integration taking a look at addressing this issue?

@JCalvi
Copy link

JCalvi commented Apr 15, 2024

2 weeks from the last, video doorbell again.
Press re-authenticate twice, then reload just the video doorbell integration and works again.
Same for me each time. I understand, not the case for all.
@starkillerOG, are you looking into this issue?

@JCalvi
Copy link

JCalvi commented Apr 16, 2024

I'm guessing this change is the cause?
75e5916
I've tried backing out the change on my install and will report if it helps or not.

Interestingly though, in my logs it looked like re-authentication happened a few times successfully over 3 days before finally failing out the last time, only relevant lines posted.

	Line 136: 2024-04-14 06:28:41.754 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 192.168.1.221:443: subscription request got a response with wrong HTTP status 400: Bad Request
	Line 159: 2024-04-14 21:17:41.635 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 192.168.1.221:443: connection error: Cannot connect to host 192.168.1.221:8000 ssl:default [Connect call failed ('192.168.1.221', 8000)].
	Line 161: 2024-04-15 01:58:59.680 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 192.168.1.221:443: subscription request got a response with wrong HTTP status 400: Bad Request
	Line 251: 2024-04-15 18:33:44.765 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 192.168.1.221:443: connection error: Cannot connect to host 192.168.1.221:8000 ssl:default [Connect call failed ('192.168.1.221', 8000)].
	Line 256: 2024-04-15 22:01:48.944 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 192.168.1.221:443: connection error: Cannot connect to host 192.168.1.221:8000 ssl:default [Connect call failed ('192.168.1.221', 8000)].
	Line 260: 2024-04-16 00:10:11.128 ERROR (MainThread) [reolink_aio.api] Host 192.168.1.221:443: login attempt failed.
	Line 261: 2024-04-16 00:10:11.145 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 192.168.1.221:443: connection error: Cannot connect to host 192.168.1.221:8000 ssl:default [Connect call failed ('192.168.1.221', 8000)].

@Scope666
Copy link

Scope666 commented Apr 16, 2024

I'm trying the change as well... will report back if it helps.

There's the async thing again, there's a bunch of issues, especially with custom components since 2024.4.1 came out, apparently they changed something that makes async a lot faster, but it broke a lot of stuff in the process.

non-thread-safe operation

I get lots of these when its trying authentication:

reolink_aio.exceptions.UnexpectedDataError: Host 192.168.1.163:80 error mapping responses to requests, received 1 responses while requesting 17 responses

@starkillerOG
Copy link
Contributor

@JCalvi yes the issue was introduced in PR #111492.
I already have a solution in mind, but I just have not found any time to implement it.
In the coming 2 weeks I will be on holliday, so not very likely I will get this fixed before then, but I am aware of the issue and will fix it eventually.

@JCalvi
Copy link

JCalvi commented Apr 16, 2024

No worries, figured you must be away.
Have a great break, and thanks for the response, let alone the great integration.

@joshwillcock
Copy link

Is there a short term work around for this? For my doorbell it's requiring new authentication every 12 hours or so making the plugin unusable.

@JCalvi
Copy link

JCalvi commented Apr 18, 2024

You can revert the change mentioned above. Need to get into the OS, edit homeassistant/components/reolink/__init__.py, remove the two added lines and restart the integration.
If you are not comfortable with doing that, you can also go back to HA 2024.2.5 and wait.

More detailed instructions for my Supervised Install on Rpi5 with DietPi 9.3 (Debian 12).

  1. ssh into host os
  2. docker exec -it homeassistant /bin/bash
  3. cd /usr/src/homeassistant/homeassistant/components/reolink
  4. vi __init__.py
  5. Delete lines 87,88 below (use dd in vi)
    except CredentialsInvalidError as err:
    raise ConfigEntryAuthFailed(err) from err
  6. Save and quit vi (:wq or ZZ)
  7. exit

All done.

@joshwillcock
Copy link

Thank you @JCalvi have given that a go, admittedly I read the first 10 comments then skipped to the last few...

@BenSanborn
Copy link

FYI, still experiencing this on 2024.5.3

Constantly re-authenticating, haven't timed it, but feels like every 4-5 days.

@capokrzywa
Copy link

Yep, same here. Mine is probably every day, sometimes 2x a day.

@Scope666
Copy link

Scope666 commented May 7, 2024

Until the change is implemented, I do this each time I update HA, it solves the issue: (Thanks @JCalvi !!!)

ssh into host os
docker exec -it homeassistant /bin/bash
cd /usr/src/homeassistant/homeassistant/components/reolink
vi __init__.py
Delete lines 87,88 below (use dd in vi)
    except CredentialsInvalidError as err:
    raise ConfigEntryAuthFailed(err) from err
Save and quit vi (:wq or ZZ)
exit

@gdt
Copy link

gdt commented May 11, 2024

I've been seeing this too, and just applied the patch above. (It seems like the issue is a transient failure getting interpreted as a confirmed auth failure, but I'm guessing the authors are far more clear on this!)

@gdt
Copy link

gdt commented May 11, 2024

I am also seeing, after doing the reauthentication, that the camera (E1 Zoom) show up twice in the integrations list. 1 has 45 entities and one has 12. But if I click either, I get the device page. I found that in .homeassistant/.storage/core.config_entities there was a 2nd entry for this camera, at the end of the file. So it's not a duplicated device, but a duplicated config entry. I suspect the bug is that the reauth flow show allow modifying and using the existing config entry and refrain from creating a new one and that this is separate from the main bug of triggering reauth on transient failures.

@starkillerOG
Copy link
Contributor

Sorry for the longer than usual wait.

I have made a fix that will prevent the ValueError: Handler is already defined! error from occuring when tyring to re-authenticate.
I was able to reproduce this issue and am sure that it will be solved in HA 2024.5.4 that will be released this friday.

I have also implemented improvements in the upstream reolink-aio library with regards to the detection of invalid credentials in an attempt to solve the false positives reported in this issue: starkillerOG/reolink_aio@ce804ed
These improvements will hopefully solve the issue when HA 2024.5.4 is released.
However I can not be sure of this.

I will close this issue now since I think it will be solved.

If you still experiance issues when you have updated to HA 2024.5.4, please let me know and I will re-open the issue and guide you through the steps of making the nessesary debug logs.

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.

@gdt
Copy link

gdt commented May 28, 2024

I'm seeing problems still, but I am wondering if they are different.

For complicated reasons, the network connection is a bit messy. But that's just a great test setup; nothing bad should happen and it should automatically deal... But I thought it was only fair to mention it.

Also, my server is https only (as all should be ;-) and I am running with a patch to be ok with failing to set up the api callback. I have provided my patch in #111640

I updated, and am now on 2024.5.5. Overall things are vastly better. But I am seeing lesser issues, which perhaps should get their own issues rather than reopening this, as I think the main bug pointed to by this issue is fixed.

  • unsubscribing push can get 401, probably if there wasn't a subscription, and this is not the same as "we think the pw is wrong"
  • similar for requesting pull point message, probably
  • the 'you need to reconfigure' alert happened, probably because of the above, but when clicking on reconfigure, it just sat there
  • after trying to reconfigure, i see two entries for the device
  • since the pw did not change, it should have reconnected automatically and then withdrawn the alert
  • reload didn't seem to get the entities back

I think there are three problems here, but of course I'm guessing a bit.

2024-05-27 08:24:13.870 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew long_poll subscription in: 334 seconds
2024-05-27 08:25:41.106 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew push subscription in: 238 seconds
2024-05-27 08:26:26.496 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3: error renewing Reolink push subscription, trying to subscribe again: Host 10.1.2.3:443: fai\
led to renew push subscription: Host 10.1.2.3:443: connection timeout exception.
2024-05-27 08:26:27.081 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3: Reolink push re-subscription successful after it was expired
2024-05-27 08:26:27.082 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew long_poll subscription in: 201 seconds
2024-05-27 08:26:27.338 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3 successfully renewed Reolink long_poll subscription
2024-05-27 08:27:52.575 ERROR (MainThread) [homeassistant.components.reolink.host] Error while requesting ONVIF pull point: Failed to request pull point message: Host 10.1.2.3:443: connecti\
on error: Server disconnected.
2024-05-27 08:33:00.574 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 10.1.2.3:443: subscription request got a response with wrong HTTP status 401: Unauthorized
2024-05-27 08:33:00.577 WARNING (MainThread) [reolink_aio.api] Error while logging out: Host 10.1.2.3:443: Timeout error:
2024-05-27 08:35:59.909 ERROR (MainThread) [homeassistant.components.reolink] Error fetching reolink.cam-6 data: Host 10.1.2.3:443: Timeout error:
2024-05-27 08:37:02.545 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3: requested to renew a non-existing Reolink push subscription, trying to subscribe from scrat\
ch
2024-05-27 08:37:03.869 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3: subscribed successfully to webhook /api/webhook/reolink_c43cb00723fa_ONVIF
2024-05-27 08:38:04.734 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew push subscription in: 837 seconds
2024-05-27 08:38:04.735 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew long_poll subscription in: 839 seconds
2024-05-27 18:24:16.851 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3: subscribed successfully to webhook /api/webhook/reolink_c43cb00723fa_ONVIF
2024-05-27 18:25:23.397 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew push subscription in: 830 seconds
2024-05-27 18:25:23.398 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew long_poll subscription in: 833 seconds
2024-05-27 18:26:26.879 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew push subscription in: 767 seconds
2024-05-27 18:26:26.879 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew long_poll subscription in: 769 seconds
2024-05-27 18:27:36.878 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew push subscription in: 697 seconds
2024-05-27 18:27:36.879 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew long_poll subscription in: 699 seconds
2024-05-27 18:30:07.796 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew push subscription in: 546 seconds
2024-05-27 18:30:07.797 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew long_poll subscription in: 549 seconds
2024-05-27 18:31:30.305 ERROR (MainThread) [homeassistant.components.reolink.host] Error while requesting ONVIF pull point: Failed to request pull point message: Host 10.1.2.3:443: subscrip\
tion request got a response with wrong HTTP status 401: Unauthorized
2024-05-27 18:32:08.905 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing long_poll: Host 10.1.2.3:443: connection timeout exception.
2024-05-27 18:33:21.607 ERROR (MainThread) [homeassistant.components.reolink] Error fetching reolink.cam-6 data: Host 10.1.2.3:443: Timeout error:
2024-05-27 18:35:53.906 WARNING (MainThread) [reolink_aio.api] Error while logging out: Host 10.1.2.3:443: Timeout error:
2024-05-27 18:39:13.547 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3: requested to renew a non-existing Reolink push subscription, trying to subscribe from scrat\
ch
2024-05-27 18:39:18.790 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3: subscribed successfully to webhook /api/webhook/reolink_c43cb00723fa_ONVIF
2024-05-27 18:41:40.453 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 10.1.2.3:443: subscription request got a response with wrong HTTP status 400: Bad Request
2024-05-27 18:41:40.737 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing long_poll: Host 10.1.2.3:443: subscription request got a response with wrong HTTP status 400: Bad Requ\
est
2024-05-27 18:41:41.880 ERROR (MainThread) [reolink_aio.api] Host 10.1.2.3:443: unknown exception "Host 10.1.2.3:443: Received 'please login first'" occurred, traceback:
reolink_aio.exceptions.LoginError: Host 10.1.2.3:443: Received 'please login first'
2024-05-27 18:41:41.900 ERROR (MainThread) [reolink_aio.api] Host 10.1.2.3:443: unknown exception "Host 10.1.2.3:443: Received 'please login first'" occurred, traceback:
reolink_aio.exceptions.LoginError: Host 10.1.2.3:443: Received 'please login first'
2024-05-27 18:41:41.901 ERROR (MainThread) [homeassistant.components.reolink] Error fetching reolink.cam-6 data: Host 10.1.2.3:443: Received 'please login first'
2024-05-27 18:42:43.102 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3: requested to renew a non-existing Reolink push subscription, trying to subscribe from scrat\
ch
2024-05-27 18:42:43.330 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3: subscribed successfully to webhook /api/webhook/reolink_c43cb00723fa_ONVIF
2024-05-27 18:43:44.022 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew push subscription in: 839 seconds
2024-05-27 18:43:44.022 DEBUG (MainThread) [homeassistant.components.reolink.host] Host 10.1.2.3:443 should renew long_poll subscription in: 839 seconds

@AussiSG
Copy link

AussiSG commented May 30, 2024

Hmmm sadly enough still happening after updating to latest HA updates:

Core 2024.5.5
Supervisor 2024.05.1
Operating System 12.3
Frontend 20240501.1
2024-05-30 19:15:13.297 ERROR (MainThread) [reolink_aio.api] Error while unsubscribing push: Host 192.168.0.21:443: subscription request got a response with wrong HTTP status 401: Unauthorized
2024-05-30 19:15:13.298 ERROR (MainThread) [homeassistant.components.reolink] Error fetching reolink.Reolink deurbel data: Host 192.168.0.21:443: Timeout error: 

2024-05-30 19:23:18.180 ERROR (MainThread) [homeassistant.components.reolink] Error fetching reolink.Reolink deurbel data: Host 192.168.0.21:443: Timeout error: 

2024-05-30 19:25:04.828 ERROR (MainThread) [reolink_aio.api] Host 192.168.0.21:443: Invalid credentials during login

2024-05-30 19:38:52.129 ERROR (MainThread) [frontend.js.latest.202405011] Failed to format translation for key 'component.reolink.config.step.reauth_confirm.title' in language 'nl'. Error: The intl string context variable "name" was not provided to the string "Authenticatie is verlopen voor {name}"

@supermarkert
Copy link

supermarkert commented May 31, 2024

Same here. I was good after the 2024.5.4 update, and the issue went away for over a week on my doorbell cam (before that fix, the issue would usually come back within a day).
I updated to 2024.5.5 earlier this week, and today the authentication error re-appeared.
This is the error in the logs:

Source: components/system_log/__init__.py:333
First occurred: 8:46:20 PM (2 occurrences)
Last logged: 8:50:11 PM

Failed to format translation for key 'component.reolink.config.step.reauth_confirm.title' in language 'en'. Error: The intl string context variable "name" was not provided to the string "Authentication expired for {name}"

@gdt
Copy link

gdt commented May 31, 2024

My theory is that various things are going wrong due to either camera firmeware bugs or network flakiness or maybe bugs in HA and we are getting a 401/403 thrown back up the stack, when really the password is ok. I suggest a two-pronged approach:

  • see if we can avoid mapping anything into auth failure that was not truly an auth failure from the camera. Maybe there's no way to do this more comprehensively than it is already
  • instead of throwing reauth on a single error, require multiple auth failures, maybe 3, maybe 10, and clear that counter every time anything succeeds. log it all of course. failing to log in, trying again, is not a big deal, while telling the user you need a new pw is a huge big deal.

@starkillerOG starkillerOG reopened this Jun 12, 2024
@starkillerOG
Copy link
Contributor

starkillerOG commented Jun 23, 2024

@gdt

  • unsubscribing push can get 401, probably if there wasn't a subscription, and this is not the same as "we think the pw is wrong"
  • similar for requesting pull point message, probably

The re-autentications can never be triggered from the ONVIF subscriptions, altought your are right and that is a wrong credentials error, those are not beeing processed to raise re-autentications.

after trying to reconfigure, i see two entries for the device

That means the MAC has likely changed, otherwise it should never make 2 entries.

since the pw did not change, it should have reconnected automatically and then withdrawn the alert

That is not how HA core works, nothing the Reolink integration can do about that. Once a Re-Authentication is triggered, the integration is stopped and not tried again (as far as I know).

@starkillerOG
Copy link
Contributor

@AussiSG strange, that means the main API is still returning "invalid user", "login failed" or "password wrong".

I think I will have to start implementing a counter and only raise after 3 consequetive failures, altough that could be a problem with the IP blocking of the Reolink camera's after 3 wrong password attempts (if the password is actually wrong), meaning the integration would be blocked and then receive Connection Refused errors. Possibly causing the integration to not detect actual password problems anymore.

@gdt
Copy link

gdt commented Jun 23, 2024

If throwing re-authentication can't be recovered from automatically, then I think it's extra important not to false. It sounds like a lot is changing in 2024.7, and I should just wait for that and see how things are.

The matching by mac caught me by surprise because I configured by IP address and I expected it to just contact the camera at that address and use it, so that swapping in a backup camera just works. But I realize this is another philosophical disagreement with HA :-)

@starkillerOG
Copy link
Contributor

This PR should further improve the situation: #120291

@starkillerOG
Copy link
Contributor

This issue should finally be solved in HA 2024.7.0, if you still get false re-auth flows when updated to 2024.7.0, please let me know.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.