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

Invalid authentication data #834

Open
seba1337 opened this issue Jan 22, 2025 · 12 comments
Open

Invalid authentication data #834

seba1337 opened this issue Jan 22, 2025 · 12 comments

Comments

@seba1337
Copy link

Description

I get a invalid authentication data error while changing Night Vision Switching on a C210 camera. If I enter the wrong cloud password in the configuration of the camera it doesn't allow me to save, so I know it's the right password, as it allowed me to save the configuration.

2025-01-22 10:28:26.923 ERROR (MainThread) [custom_components.tapo_control] 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

Reproduction Steps

  1. Click on "Night Vision Switching" entity of the camera
  2. Change the setting from off to auto or on.

Expected behavior

I expected for the mode to be changed and to not throw any errors.

If applicable, add error logs.

No response

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

Docker

Search for similar issues

Yes

Additional information

No response

@seba1337 seba1337 changed the title Invalid authentication data [Solved?] Invalid authentication data Jan 22, 2025
@seba1337
Copy link
Author

It started to work. No idea why. I tried various other options, also refreshed the webpage of HA and it stopped throwing those errors and started to work. Weird.

@seba1337
Copy link
Author

OK again doesn't work, didn't change anything, just added an entity in the dashboard.
File "/usr/local/lib/python3.13/site-packages/pytapo/__init__.py", line 621, in performRequest raise Exception( ...<4 lines>... ) Exception: Error: -40214, Response: {"error_code": -40214}

@seba1337 seba1337 changed the title [Solved?] Invalid authentication data Invalid authentication data Jan 22, 2025
@seba1337
Copy link
Author

I went on the device page, where you get all the entities of the Tapo Control camera, there I've changed and it first didn't work (same error) then it started to work. It's random, I can't see any pattern.
raceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<7 lines>... ) ^ File "/usr/src/homeassistant/homeassistant/core.py", line 2795, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2838, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1006, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ hass, entity, func, data, call.context ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1078, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 188, in async_handle_select_option await self.async_select_option(option) File "/config/custom_components/tapo_control/select.py", line 577, in async_select_option result = await self._hass.async_add_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ self.method, getNightModeValue(option) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ 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 1775, in setDayNightMode return self.__setImageCommon("inf_type", mode) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/pytapo/__init__.py", line 1832, in __setImageCommon return self.executeFunction( ~~~~~~~~~~~~~~~~~~~~^ "setLightFrequencyInfo", {"image": {"common": {field: value}}} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/pytapo/__init__.py", line 491, in executeFunction data = self.performRequest( ~~~~~~~~~~~~~~~~~~~^ { ^ ...<2 lines>... } ^ )["result"]["responses"][0] ^ File "/usr/local/lib/python3.13/site-packages/pytapo/__init__.py", line 619, in performRequest return self.performRequest(requestData, loginRetryCount + 1) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/pytapo/__init__.py", line 621, in performRequest raise Exception( ...<4 lines>... ) Exception: Error: -40214, Response: {"error_code": -40214}

@JurajNyiri
Copy link
Owner

The error codes are not described and we do not know what that specific error code is for. It is possible it’s not always able to activate the night vision mode for some reason.
Once you figure out the reason please let us know and I can add a better handler.

Authentication related message is probably related to camera being overloaded or buggy, see faq on that. I would not focus on that when figuring this out.

@seba1337
Copy link
Author

seba1337 commented Jan 22, 2025

Interesting, like it was getting/sending "" at some point instead of auto|on|off.

2025-01-22 12:56:17.727 ERROR (MainThread) [custom_components.tapo_control] Error: -40214, Response: {"error_code": -40214} 2025-01-22 12:56:17.807 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140082897662688] Option is not valid for entity select.k1_night_vision_switching, valid options are: auto, on, off

@BambamNZ
Copy link

BambamNZ commented Jan 23, 2025

I get the same error, while not even trying to change something, with a vast increase of "authentication has expired" notifications - multiple times a day

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: 9:30:29 PM (24 occurrences)
Last logged: 10:28:36 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

@JurajNyiri
Copy link
Owner

@BambamNZ what is everything that is using the camera? Any scrypted, go2rtc, other HA integrations etc?

@BambamNZ
Copy link

@BambamNZ what is everything that is using the camera? Any scrypted, go2rtc, other HA integrations etc?

I have 4 camera's and one 1 automation associated with one of the cameras, only integrations are the the Tapo: Camera Control & TP-Link Smart Home then used to display the Video Stream on a Dashboard card, that wasn't active / open during the time the errors was logged. The Automation wasn't triggered during that time either.

Since my first post and this post the count has increased by 5 occurrences

Logger: custom_components.tapo_control
Source: helpers/update_coordinator.py:379
integration: Tapo: Cameras Control ([documentation](https://github.com/JurajNyiri/HomeAssistant-Tapo-Control), [issues](https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues))
First occurred: 9:30:29 PM (29 occurrences)
Last logged: 10:54:14 PM

I'm getting a array of error messages from the cameras - this all in the last 30 or so minutes

Image

@JurajNyiri
Copy link
Owner

Remove camera from TP-Link Smart Home.

This is documented here https://github.com/JurajNyiri/HomeAssistant-Tapo-Control?tab=readme-ov-file#usage

When integrating Tapo cameras, ensure only ONE integration is used. If multiple are used at the same time it will result in conflicts and instability of connection to camera for all the integrations / services connecting to camera.

@BambamNZ
Copy link

BambamNZ commented Jan 23, 2025

Remove camera from TP-Link Smart Home.

This is documented here https://github.com/JurajNyiri/HomeAssistant-Tapo-Control?tab=readme-ov-file#usage

When integrating Tapo cameras, ensure only ONE integration is used. If multiple are used at the same time it will result in conflicts and instability of connection to camera for all the integrations / services connecting to camera.

Done, removed them from TP-Link Smart Home - Thank you for the advice
Will monitor and report back

Update - After 12+ hours no error messages, issues resolved for me - Thanks

@igi01

This comment has been minimized.

@JurajNyiri

This comment has been minimized.

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

4 participants