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

Authentication expired for Tapo cameras #828

Closed
DAE51D opened this issue Jan 17, 2025 · 3 comments
Closed

Authentication expired for Tapo cameras #828

DAE51D opened this issue Jan 17, 2025 · 3 comments

Comments

@DAE51D
Copy link

DAE51D commented Jan 17, 2025

Description

I have about 30 cameras of various brands (Reolink, Kasa, Tapo, Ring, Blink, etc.) and of all of them, these two Tapo are the only ones that constantly keep giving me this notice every week or so it seems. It's gotten real annoying.

Image

I click on the "repair" notice and get the user/pass prompt.

Image

First of all, why isn't this pre-filled with the user/pass I have to keep putting in. The credentials do not change!

So I have to look them up in my password manager, paste them in and then I get a successful notice.

Image

Why is this even happening though at all to begin with? Nothing changes to prompt this behaviour.

Another issue is that I often see this happen on the "second" camera (whichever one I did NOT add creds again above)

Image

Oddly though if I look at the integration page, they BOTH "appear" to be good again?!

Image

Despite the "Settings" page STILL showing this repair needed. 😕

Image

Reproduction Steps

I wish I knew. It just randomly happens it feels, but frequently like every week at least.

I run my HAOSS in Proxmox. That shuts down HA every night to do a snapshot backup, so maybe there's something to do with the constant shutdown/restart and your integration has a limit that is expiring or something? IDK. Nothing else does this and I have a LOT of integrations...

Image

Expected behavior

Remember the credentials. Retry silently until they work or something. They're not changing. They work when I manually re-enter them in your dialog. Pre-fill the dialog so I can just click the button if needed rather than re-populate them manually.

If applicable, add error logs.

I would if I knew where to find them? I did some basic search for "Tapo" but found nothing... happy to provide if you tell me how/what to do...

Image

Device Firmware

1.4.4 Build 241211 Rel.42339n

Integration Version

6.0.9

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

HAOSS VM on Proxmox

Search for similar issues

Yes

Additional information

No response

@JurajNyiri
Copy link
Owner

JurajNyiri commented Jan 17, 2025

The integration already remembers credentials.

It does 3 retries with credentials, like suggested, when camera returns unauthenticated response, before stopping trying and issuing the prompt to user.

It is possible that if you have more integrations or other tools using the camera, the camera returns unauthenticated response (camera implementation keeps sequence, if requests come out of it, it behaves like it is unauthenticated). I suggest using only 1 tool with the camera for control (the one using cloud password).

Credentials are stored in .storage/config_entries like for every integration for HA configured through UI.

Logs from integration are under Home Assistant Core logs. You can also enable debug logs.

I would also check those credentials in that file when that happens, something might be overwriting that file in your env?

@BambamNZ
Copy link

BambamNZ commented Jan 18, 2025

Facing the same issue, getting prompted sometimes multiple times a day with "authentication has expired" from my Tapo cameras.

Yes the GUI does remember the credentials, clicking "submit" works, but I still have to do it manually.

This is the log entry from the latest event

This error originated from a custom integration.

Logger: custom_components.tapo_control
Source: helpers/update_coordinator.py:379
integration: Tapo: Cameras Control (documentation, issues)
First occurred: 12:07:00 PM (4 occurrences)
Last logged: 12:29:28 PM

Unexpected error fetching Tapo resource status data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 379, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 280, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo_control/__init__.py", line 614, in async_update_data
    raise e
  File "/config/custom_components/tapo_control/__init__.py", line 552, in async_update_data
    updateDataForAllControllers[controller] = await getCamData(
                                              ^^^^^^^^^^^^^^^^^
        hass, controller
        ^^^^^^^^^^^^^^^^
    )
    ^
  File "/config/custom_components/tapo_control/utils.py", line 723, in getCamData
    data = await hass.async_add_executor_job(controller.getMost)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.13/site-packages/pytapo/__init__.py", line 2152, in getMost
    results = self.performRequest(requestData)
  File "/usr/local/lib/python3.13/site-packages/pytapo/__init__.py", line 618, in performRequest
    self.refreshStok()
    ~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/pytapo/__init__.py", line 464, in refreshStok
    raise Exception("Invalid authentication data")
Exception: Invalid authentication data

@BambamNZ
Copy link

Hi @JurajNyiri

Here is UI error

Image

I changed nothing in the below, just clicked "submit"

Image

and then clicked submit again

Image

to get here

Image

all four my camera's has done this now at least twice in the last 24 hours

I do not have any other integrations beyond yours and the Tapo integrations and then 1 automation associated with one cam only, based on a trigger from the camera.

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

No branches or pull requests

3 participants