JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
957 stars 80 forks source link

Unexpected error fetching Tapo resource status data: Invalid authentication data #478

Closed aIexus closed 7 months ago

aIexus commented 7 months ago

Description

From time to time in HA Core Logs I see error: Unexpected error fetching Tapo resource status data: Invalid authentication data But C200 camera is working after this error in normal mode.

Reproduction Steps

N/A

Expected behavior

No any errors

If applicable, add error logs.

2023-11-30 04:34:10.319 ERROR (MainThread) [custom_components.tapo_control] Unexpected error fetching Tapo resource status data: Invalid authentication data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 246, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo_control/init.py", line 458, in async_update_data raise e File "/config/custom_components/tapo_control/init.py", line 449, in async_update_data updateDataForAllControllers[controller] = await getCamData( ^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo_control/utils.py", line 625, in getCamData data = await hass.async_add_executor_job(controller.getMost) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pytapo/init.py", line 1814, in getMost results = self.performRequest(requestData) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pytapo/init.py", line 616, in performRequest self.refreshStok() File "/usr/local/lib/python3.11/site-packages/pytapo/init.py", line 423, in refreshStok raise Exception("Invalid authentication data") Exception: Invalid authentication data

Device Firmware

1.3.9 Build 231019 Rel. 38052n(4555)

Integration Version

5.4.12

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Raspberry Pi 4 Model B with Debian GNU/Linux 12 (bookworm)

Search for similar issues

Yes

Additional information

HA Core: 2023.11.3 Supervisor: 2023.11.6 Docker: 24.0.7

JurajNyiri commented 7 months ago

This is expected, sometimes camera responds with invalid auth data and we want to log the error. Integration retries later and if camera no longer sends that it keeps on working. If camera sends it too many times in a row, reauth request is issued to HA.