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

Camera needs to be reconfigured when Home Assistant restarts #453

Closed
jtsarnas76 opened this issue Nov 9, 2023 · 51 comments
Closed

Camera needs to be reconfigured when Home Assistant restarts #453

jtsarnas76 opened this issue Nov 9, 2023 · 51 comments
Labels
Fixed Bug has been fixed.

Comments

@jtsarnas76
Copy link

Description

Using 4 tapo C310 cameras. 3 are working great. Fourth needs to be reconfigured every time ha restarts. Camera uses firmware 1.3.9 and it's hardware version 1.0. All 4 cameras using same credentials.

Reproduction Steps

  1. Originaly configured tapo camera and worked as expected
  2. On HA restart I get a notification that Integration requires reconfiguration
  3. I reconfigure using same credentials and works ok again

Expected behavior

Work with no need of reconfiguration

If applicable, add error logs.

Logger: homeassistant.config_entries
Source: config_entries.py:426
First occurred: 8:10:06 PM (1 occurrences)
Last logged: 8:10:06 PM

Config entry '192.168.1.49' for tapo_control integration could not authenticate: Invalid authentication data

This error originated from a custom integration.

Logger: custom_components.tapo_control
Source: custom_components/tapo_control/init.py:760
Integration: Tapo: Cameras Control (documentation, issues)
First occurred: 8:10:06 PM (1 occurrences)
Last logged: 8:10:06 PM

Unable to connect to Tapo: Cameras Control controller: Invalid authentication data

Device Firmware

1.3.9 Build 231024 Rel. 73362n(4555)

Integration Version

5.4.4

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

HAOS bare metal x86

Search for similar issues

Yes

Additional information

No response

@JurajNyiri
Copy link
Owner

Are the other cameras using the new firmware as well?

@jtsarnas76
Copy link
Author

No. 2 are on 1.3.7, the third on 1.3.2

@jtsarnas76
Copy link
Author

Come to think of it, problem occurred after update, a couple of days ago

@JurajNyiri
Copy link
Owner

Try to factory reset the camera and remove and add to ha. Does the problem still happen?

@jtsarnas76
Copy link
Author

I 'll give it a go tomorrow and will provide feedback

@JurajNyiri

This comment was marked as off-topic.

@flipaz

This comment was marked as off-topic.

@ryann72
Copy link

ryann72 commented Nov 10, 2023

hello, I have the same problem with my two c210 cameras on the latest firmware 1.3.9 with the latest version available under hacs from tapo control

@Lorus-X

This comment was marked as off-topic.

@Ashk0812
Copy link

I too have this error since the update.

@cmdev100
Copy link

I have the same issue with FW 1.3.9.
The log says:
2023-11-11 17:07:23.814 ERROR (MainThread) [custom_components.tapo_control] Unable to connect to Tapo: Cameras Control controller: Invalid authentication data

Not sure it's the correct log row though.

@jtsarnas76
Copy link
Author

Try to factory reset the camera and remove and add to ha. Does the problem still happen?

Did that, problem still there. Has to be a firmware issue.

@ryann72
Copy link

ryann72 commented Nov 11, 2023

Is it possible to downgrade the camera firmware?

@joebar38
Copy link

Hello,
Same problem here, a daily reconfiguration required... Not possible to downgrade the camera firmware

@ryann72

This comment was marked as off-topic.

@JurajNyiri
Copy link
Owner

@ryann72 you are overloading the camera. It supports max 2 concurrent streams. This topic is not for your issue and it is not integration issue at all.

@JurajNyiri
Copy link
Owner

@joebar38
Does this issue happen only on home assistant start or after some time running as well? It is important to properly describe the issue.

@jtsarnas76
Copy link
Author

On my part, it happens when home assistant starts

@JurajNyiri
Copy link
Owner

I will need a camera with ports 443 and 554 port forwarded along with all credentials so that I can debug this as I do not currently own camera with this firmware. Contact me via [email protected].

@joebar38
Copy link

Ce problème se produit-il uniquement au démarrage de l’assistant domestique ou après un certain temps d’exécution ? Il est important de bien

@joebar38 Does this issue happen only on home assistant start or after some time running as well? It is important to properly describe the issue.

Sometimes AT start, but frequently some Time running as well

@ryann72

This comment was marked as off-topic.

@juliomatcom
Copy link

Hello, Same problem here, a daily reconfiguration required... Not possible to downgrade the camera firmware

you can try factory reset

@joebar38
Copy link

Hello, Same problem here, a daily reconfiguration required... Not possible to downgrade the camera firmware

you can try factory reset

I already tried. I also completely removed the integration and completely reconfigured, but same problem

@juliomatcom
Copy link

juliomatcom commented Nov 12, 2023

I just factory reset it but the same firmware 1.3.9 is still there, this error started today or yesterday for me.

Unable to connect to Tapo: Cameras Control controller: Invalid authentication data

It was working fine with the Firmware: 1.3.7 Build 230823 Rel.55314n(4555), we better leave the auto update disabled for sure.

@cmdev100
Copy link

cmdev100 commented Nov 12, 2023

Make sure you update the "Tapo: cameras control" to the latest version 5.4.4. I had version 5.1 (manuall install, not by HACS).
My camera with 1.3.9 works now.

@joebar38
Copy link

joebar38 commented Nov 13, 2023

Error this morning without reboot during night :
[custom_components.tapo_control] Authentication failed while fetching Tapo resource status
@JurajNyiri how do you send the logs you need?

@Jimb62
Copy link

Jimb62 commented Nov 13, 2023

I have 4 camera C200 and 2 camera c310. With the last firware 1.3.7 no problem. Since the c200 camera update to 1.3.9 i also have problems and need to reconfigure and sometimes to disconnect the power off one or other camera. So i decide to wait for upgarding the firware of the c310 camera. Problems arrive sometimes when HA reboot or sometimes when it is runnnig since a few days. i don't detect a specific action for having the problem.

@jtsarnas76
Copy link
Author

Make sure you update the "Tapo: cameras control" to the latest version 5.4.4. I had version 5.1 (manuall install, not by HACS). My camera with 1.3.9 works now.

I was already on 5.4.4 version when the problem occurred with fw 1.3.9

@Jimb62

This comment was marked as off-topic.

@JurajNyiri
Copy link
Owner

JurajNyiri commented Nov 13, 2023

I received the update today and my C200 v3.0 works flawlessly (even with 2 HA instances hitting it at the same time!) so far (few minutes :-) ).

I will keep it running and see if I notice anything suspicious.

Unless someone else can find the issue, as I said yesterday, I will need a camera with ports 443 and 554 port forwarded along with all credentials so that I can debug this as I do not currently own camera experiencing this issue. Contact me via [email protected].

Further comments "me too" providing no new information will be hidden.

@FSHelgeland

This comment was marked as duplicate.

@JurajNyiri
Copy link
Owner

JurajNyiri commented Nov 15, 2023

Upgrade to 5.4.6.

Add following to configuration.yaml:

logger:
  logs:
    custom_components.tapo_control: debug

Post full log in case of an error.

If you see Incorrect pytapo version installed error on start, fix your environment.

@JurajNyiri JurajNyiri added the Help wanted Extra attention is needed label Nov 15, 2023
@joebar38
Copy link

Another error for me with 5.4.6 :

2023-11-16 19:13:04.354 DEBUG (SyncWorker_8) [custom_components.tapo_control] [pytapo] 200 2023-11-16 19:13:04.355 DEBUG (SyncWorker_8) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': 'REDACTED'}}} 2023-11-16 19:13:04.364 DEBUG (SyncWorker_2) [custom_components.tapo_control] [pytapo] 200 2023-11-16 19:13:04.364 DEBUG (SyncWorker_2) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': 'REDACTED'}}} 2023-11-16 19:13:04.367 DEBUG (SyncWorker_2) [custom_components.tapo_control] [pytapo] New request: 2023-11-16 19:13:04.368 DEBUG (SyncWorker_2) [custom_components.tapo_control] [pytapo] {'data': {'method': 'login', 'params': {'cnonce': 'REDACTED', 'encrypt_type': '3', 'digest_passwd': 'REDACTED', 'username': 'admin'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8', 'Seq': '873', 'Tapo_tag': 'REDACTED'}, 'verify': False} 2023-11-16 19:13:04.373 DEBUG (SyncWorker_10) [custom_components.tapo_control] [pytapo] 200 2023-11-16 19:13:04.373 DEBUG (SyncWorker_10) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': 'REDACTED'}}} 2023-11-16 19:13:04.406 DEBUG (MainThread) [custom_components.tapo_control] mediaSync 2023-11-16 19:13:04.502 DEBUG (SyncWorker_2) [custom_components.tapo_control] [pytapo] 200 2023-11-16 19:13:04.503 DEBUG (SyncWorker_2) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': ''}}} 2023-11-16 19:13:04.506 ERROR (MainThread) [custom_components.tapo_control] Authentication failed while fetching Tapo resource status data: Invalid authentication data 2023-11-16 19:13:04.507 DEBUG (MainThread) [custom_components.tapo_control] Finished fetching Tapo resource status data in 0.971 seconds (success: False) 2023-11-16 19:13:04.509 DEBUG (MainThread) [custom_components.tapo_control] [REAUTH][192.168.1.5] Showing config flow for reauth - stream. 2023-11-16 19:13:33.351 DEBUG (SyncWorker_4) [custom_components.tapo_control] [pytapo] Failure detecting hashing algorithm on getTag, reauthenticating.

@MattJeanes
Copy link

MattJeanes commented Nov 16, 2023

@JurajNyiri I have just emailed over to you a couple of log traces

reauth.log this is when the popup appeared in the notifications to re-auth. Home Assistant had been up for a few hours at this point.

reauth-2.log this is when I went through the re-auth flow which completed successfully. I did not change any settings just pressed submit twice.

Hopefully this helps, I have the full log files but they were massive so I tried scoping them down to roughly the interesting area, but let me know if you need anything more. Going to disable debug logging for now as it's writing a ton.

Note that restarting Home Assistant seems to temporarily mitigate the issue, as does re-authing, but it comes back.

No results in log for Incorrect pytapo version installed by the way

@JurajNyiri
Copy link
Owner

JurajNyiri commented Nov 16, 2023

Thank you, I will need to add more logs into pytapo to find the reason of "Invalid authentication data" as from these logs it could be either https://github.com/JurajNyiri/pytapo/blob/main/pytapo/__init__.py#L408 or https://github.com/JurajNyiri/pytapo/blob/main/pytapo/__init__.py#L389 or even https://github.com/JurajNyiri/pytapo/blob/main/pytapo/__init__.py#L317 in theory.

@JurajNyiri
Copy link
Owner

Please download and install https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/tree/pytapo_3.3.12 manually.

Add following to configuration.yaml:

logger:
  logs:
    custom_components.tapo_control: debug

Post full log in case of an error, now we will know what exactly happened during auth.

@MattJeanes
Copy link

I wasn't too sure how to install the custom version and I don't have direct file access so I applied the changes in this commit in the folder in custom_components and restarted Home Assistant (with the debug logging back on)

Hopefully that does the job but not too sure how HA installs python dependencies for custom components

@JurajNyiri
Copy link
Owner

JurajNyiri commented Nov 17, 2023

That should do it! It installs from manifest.json*, if you did the change PYTAPO_REQUIRED_VERSION = "3.3.12" and it launched as expected (no error) you are running the correct version.

*Except some unsupported setups users are running where the pytapo version can be older and it does not install automatically... that is why I added the check recently.

@MattJeanes
Copy link

Yep I did that change as well, and it's up and currently working - so fingers crossed! I'll hang tight for it to request re-auth again and pop over the logs as before, might be tomorrow we'll see how fast it comes up.

@silfax

This comment was marked as duplicate.

@MattJeanes
Copy link

@JurajNyiri we've had two cameras (out of 3) fail overnight, I've sent over hopefully the relevant parts of the logs - let me know if you need anything else!

@JurajNyiri
Copy link
Owner

Thank you @MattJeanes ! It looks like it is failing with Incorrect device_confirm value, raising Exception.. Probably camera requiring additional refresh.

-40413: INVALID_NONCE
-40401: SESSION_EXPIRED

I will put in additional refresh and lets see if it solves the issue.

@JurajNyiri
Copy link
Owner

JurajNyiri commented Nov 17, 2023

@MattJeanes Please download and install https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/tree/fix_453 manually. (Change pytapo references to PYTAPO_REQUIRED_VERSION = "3.3.15" and "pytapo==3.3.15" if applying the code manually) I added an internal retry in the pytapo so hopefully this will solve the issue.

Add following to configuration.yaml:

logger:
  logs:
    custom_components.tapo_control: debug

Please share logs in case of issue persisting or confirm if the issue is no longer present.

Edit: Added one more area for retry that I encountered during resolving unrelated issue, use 3.3.15.

@MattJeanes
Copy link

Applied pytapo 3.3.15 and rebooted now - I'll let you know! If it doesn't do it within 2 days then that's probably done it :)

@MattJeanes
Copy link

Oh no, it blew up already! I've sent over the full log since startup although I think I accidentally disabled the debug logging before I went through the re-auth flow again, some interesting errors from that too right at the bottom.

@JurajNyiri
Copy link
Owner

JurajNyiri commented Nov 17, 2023

Config entry has already been setup! is something wrong with env. Make sure to completely remove the camera (make sure to check .storage folder as well for any tapo_control references and remove it there) and add again.

@JurajNyiri
Copy link
Owner

@JurajNyiri JurajNyiri added Fixed Bug has been fixed. and removed Help wanted Extra attention is needed labels Nov 17, 2023
@sandimartian
Copy link

I still have the problem with version 5.4.8. After a certain amount of time, I have no stream from the camera (C200, hw 1.0, firmware 1.3.9). Problem can be solved only by rebooting the camera and reintroducing the credentials in HA.

@JurajNyiri
Copy link
Owner

This issue solves control issues, not stream. Read FAQ for stream issue.

@MattJeanes
Copy link

I'm on 5.4.8 now and still been getting issues and I've managed to grab some more debug level logs. I can see that there is 5.4.10 out now which I'm just updating to now, but I thought I'd send them over anyway in case they are useful to you. I'll let you know if I see anything further on 5.4.10.

@bifi87
Copy link

bifi87 commented Apr 5, 2024

Hello @ All, i need your help :)

i cant see and configure a live view from my tapo doorbell d230s1 hub h200 is with the ethernet cable wired to the fritzbox...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Bug has been fixed.
Projects
None yet
Development

No branches or pull requests