Closed kwermeister closed 8 months ago
Please post actual log file of when it starts happening, not just the summary.
Yes, but where can I find them? (Sorry, I am a layman.)
https://www.home-assistant.io/integrations/system_log/
Live examples of these events can be found in the Home Assistant log file (home-assistant.log) or by just looking in the system log. An example could, for instance, look like this:
Download branch https://github.com/JurajNyiri/pytapo/tree/debug_request manually, and next to README.md create file test.py with content:
from pytapo import Tapo
# Camera
password_cloud = "" # cloud password
host = "" # ip of the camera, example: 192.168.1.52
redactInformation = True
tapo = Tapo(host, "admin", password_cloud, "", "", None, False, redactInformation)
requestNum = 0
while True:
requestNum += 1
print("Request number: " + str(requestNum))
tapo.getBasicInfo()
from pytapo import Tapo
import time
# Camera
password_cloud = "" # cloud password
host = "" # ip of the camera, example: 192.168.1.52
redactInformation = True
tapo = Tapo(host, "admin", password_cloud, "", "", None, False, redactInformation)
requestNum = 0
while True:
requestNum += 1
print("Request number: " + str(requestNum))
tapo.getBasicInfo()
time.sleep(10)
Run using python3 in command line, if you get failures of missing modules, just run python3 -m pip install <package>
Let both running for a while (not at the same time), post the part of the script just when it starts failing and how it keeps failing.
Please post actual log file of when it starts happening, not just the summary.
For example, the problem occurred at around 20:14.
To figure out whether time or number of requests is the issue
Sorry, but this is absolutely beyond my capabilities.
Thank you for the logs. We will need to wait for someone else experiencing the same issue to run the scripts then.
@fcachado @Swampen @viprapp @bonvga does it run well for you?
I have the same problem. I will try to download the logs and run the scripts as soon as possible and I'll post here
Script 1 result (it only took less than 2 seconds to fail:
{'data': {'method': 'securePassthrough', 'params': {'request': 'REDACTED'}}, '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': '716', 'Tapo_tag': 'REDACTED'}, 'verify': False}
500
{'error_code': 0, 'seq': 716, 'result': {'response': 'REDACTED'}}
Traceback (most recent call last):
File "/home/pi_user/Projects/tapo/pytapo/test1.py", line 11, in <module>
tapo.getBasicInfo()
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 785, in getBasicInfo
return self.executeFunction(
^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 341, in executeFunction
data = self.performRequest(
^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 433, in performRequest
if not self.responseIsOK(res, responseJSON):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 323, in responseIsOK
raise Exception(
Exception: Error communicating with Tapo Camera. Status code: 500
Script 2:
Request number: 2
{'data': {'method': 'securePassthrough', 'params': {'request': 'REDACTED'}}, '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': '472', 'Tapo_tag': 'REDACTED'}, 'verify': False}
500
{'error_code': 0, 'seq': 472, 'result': {'response': 'REDACTED'}}
Traceback (most recent call last):
File "/home/pi_user/Projects/tapo/pytapo/test2.py", line 13, in <module>
tapo.getBasicInfo()
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 785, in getBasicInfo
return self.executeFunction(
^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 341, in executeFunction
data = self.performRequest(
^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 433, in performRequest
if not self.responseIsOK(res, responseJSON):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 323, in responseIsOK
raise Exception(
Exception: Error communicating with Tapo Camera. Status code: 500
Thank you @fcachado . What was inside response? There is no reason to redact it in most of the cases, if it is encrypted it is literarily impossible to decrypt (even if I knew your password) and if it is not encrypted getBasicInfo has no confidential information.
Also I see script 2 failing on Request number: 2. Can you try again? That seems very unexpected. In script 1 you have removed the Request number: string. It is hard to debug if you do not provide the whole log file as requested. Please post the whole log.
Script 1
Request number: 37
{'data': {'method': 'securePassthrough', 'params': {'request': 'FJ9cQdeWUM0uw2YNlxVFdInnfzOrzwFu2Ux2LhAF/w7MLOaOjNWpZJ8tJiV/FQo2hED8pcrM4P81OJdcrAScDKdw5+SrM1uVvz/VwAptWJoz5n4XwbKZiUh8N5H9lpOgLfe3o3pPr00HqfrQPxC8ppxEyatZ064wxbbR9b9rY9/GhqvfVk27Hhh5aopA1isq'}}, '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': '489', 'Tapo_tag': 'REDACTED'}, 'verify': False}
500
{'error_code': 0, 'seq': 489, 'result': {'response': 'rLhPegMjLKTGSAmxgfBttAhEhHwnRijW8JeMKY9puEEPjM7//qyvOM5HHxKR7XNuk174rGfxQ9hX/inEIYCzd09T4IxT+jb3hu7HhFSDH2v9KpsNUlWeKGQCWAOq6Im5'}}
Traceback (most recent call last):
File "/home/pi_user/Projects/tapo/pytapo/test1.py", line 11, in <module>
tapo.getBasicInfo()
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 785, in getBasicInfo
return self.executeFunction(
^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 341, in executeFunction
data = self.performRequest(
^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 433, in performRequest
if not self.responseIsOK(res, responseJSON):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 323, in responseIsOK
raise Exception(
Exception: Error communicating with Tapo Camera. Status code: 500
Script 2 (it fails on iteration number 2) @JurajNyiri
Request number: 2
{'data': {'method': 'securePassthrough', 'params': {'request': 'ow6rx2se91dKq3QMh6ukuXGBHCIqyNNdkwZUWd3FUx8gpwlTuEUV5a3qXjIwnRiYD7Q7u1W9Awet73S/F0pzLOVML+gAE9YNVbZkOikZnduv81gHhSlK9D59rcYhg/kvb79b7ljVJoiDIQb04A9su1WcMZkD/NshwNIUO6WX4IxIbZAaqeuqITGyBtAKqmOh'}}, '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': '561', 'Tapo_tag': 'REDACTED'}, 'verify': False}
500
{'error_code': 0, 'seq': 561, 'result': {'response': 'am9fsPnZLT/qr6BOtMDLBckcRO/AuAzFnqa/0gzraubsgVNfI3bTaAQ9qwBA/g+rvwHA8FCJlLJMQHnMODSpha7hyjErs1YGoCHA1Aal6LldjB/Zc1kzgjnuHnMK4UHW'}}
Traceback (most recent call last):
File "/home/pi_user/Projects/tapo/pytapo/test2.py", line 13, in <module>
tapo.getBasicInfo()
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 785, in getBasicInfo
return self.executeFunction(
^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 341, in executeFunction
data = self.performRequest(
^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 433, in performRequest
if not self.responseIsOK(res, responseJSON):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 323, in responseIsOK
raise Exception(
Exception: Error communicating with Tapo Camera. Status code: 500
@fcachado Thank you! Please pull/download the branch again, I have added a print which logs a decoded response. Knowing what is in the last response should help us understand the issue. Please run the scripts again.
@JurajNyiri For both script the decoded message was the same "Http seq illegaly"
Script 1
Request number: 12
{'data': {'method': 'securePassthrough', 'params': {'request': 'mJ1JxqjSatl39y4xP0Cswo2XZOMK8TF8fLOmUdp94J2tPR5S3nyP77KZQe96/CsMOqTT7uDb/t8tGlNoV71luDaWA0YVXIrKzfHiue18K8atf3blyOPrgRJNLozCQXdiFovXcn++ZNNi8P+8ac8wsb3ImZKvimy4GFDAxMC/bStFRohtbuCnxEU49mNlxfj5'}}, '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': '28', 'Tapo_tag': 'REDACTED'}, 'verify': False}
500
{'error_code': 0, 'seq': 28, 'result': {'response': 'vPz0h/fww6++oo/uu13m716jG26S9wr1G8xtBl/yBQOjVLJqw2/Tb5yi6tu7HOn8mrNZf9BKO3jSlNRrWTKbMRQh0zNZXKAYGOb52n/hPa95RtVZ2+VBttDaPOX3VDqC'}}
{'result': {'responses': [{'msg': 'Http seq illegaly', 'error_code': -1}]}, 'error_code': -1}
Traceback (most recent call last):
File "/home/pi_user/Projects/tapo/pytapo/test1.py", line 11, in <module>
tapo.getBasicInfo()
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 786, in getBasicInfo
return self.executeFunction(
^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 341, in executeFunction
data = self.performRequest(
^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 434, in performRequest
if not self.responseIsOK(res, responseJSON):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi_user/Projects/tapo/pytapo/pytapo/__init__.py", line 323, in responseIsOK
raise Exception(
Exception: Error communicating with Tapo Camera. Status code: 500
Very interesting, lets try to reauth on this specific error. I will provide new code to try out soon.
@fcachado Please try again with the same branch, I have pushed a new logic that should refresh auth on this error. Please post as much logs as possible in case there is still an issue, more is better and allows me to debug more efficiently.
It's running for the last 5m without any error
@fcachado That's great! Keep it running for a few hours just to make sure. Please report back in like 2-3 hours, my meetings would've finished by then and I can release the fix to public.
It's still running without issues @JurajNyiri
It's still running without issues @JurajNyiri
Can confirm that
Thank you! I will publish fix in a couple of hours.
I'm still unable to control my C210 with FW 1.3.9 Build 231019 Rel.13805n(4555). After adding the camera in the integration I get the following error:
Logger: homeassistant.config_entries
Source: config_entries.py:402
First occurred: 23:24:15 (10 occurrences)
Last logged: 23:24:15
Error setting up entry 192.168.0.18 for select
Error setting up entry 192.168.0.18 for siren
Error setting up entry 192.168.0.18 for update
Error setting up entry 192.168.0.18 for binary_sensor
Error setting up entry 192.168.0.18 for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 440, in async_setup_entry
return await component.async_setup_entry(entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry
raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
The following error appears constantly, especially when I want to use the control button or switches:
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:230
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 23:25:05 (4 occurrences)
Last logged: 23:35:03
[547302362560] Padding is incorrect.
[547302152000] Padding is incorrect.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
response_data = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 124, in _async_press_action
await self.async_press()
File "/config/custom_components/tapo_control/button.py", line 194, in async_press
await self._hass.async_add_executor_job(self._controller.moveMotor, degrees, 0)
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 852, in moveMotor
return self.performRequest(
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 385, in performRequest
responseJSON = json.loads(self.decryptResponse(encryptedResponse))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 332, in decryptResponse
return unpad(pt, AES.block_size)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/Crypto/Util/Padding.py", line 92, in unpad
raise ValueError("Padding is incorrect.")
ValueError: Padding is incorrect.
I've been having these problems since the release 5.4.0 for the new authorization for Tapo FW 1.3.9 and had hoped that they could be fixed with release 5.4.1, but unfortunately not.
Please help
@mafr95 does the camera work at first and then goes unavailable or not at all?
@fcachado @kwermeister please confirm fix working
The stream works perfectly. The switch, button etc. entities are available in HA. But I can't use them, from the beginning after adding the camera. Every time the error Padding is incorrect
occurs.
EDIT : Entities are available means they are not grayed out.
If you make an update to the camera (for example setting privacy mode) through the app, does the change show in HA?
from the beginning after adding the camera
When did you add the camera?
ValueError: Config entry has already been setup!
This also shows something really weird going on with the envrionment. Try to clear everything tapo_control related (go through entries in .storage as well after removing via UI, restart HA) and set up again.
ValueError: Config entry has already been setup!
This also shows something really weird going on with the envrionment. Try to clear everything tapo_control related (go through entries in .storage as well after removing via UI, restart HA) and set up again.
Done. So far no error after adding or controlling the camera.
Thank you so much for your time and work!
@fcachado @kwermeister please confirm fix working
@JurajNyiri a big thank you for your efforts. After a few restarts of the camera and HA, it runs and can be controlled as before. Today the 1.3.9 updates for my other 2 cameras arrived on time. The only thing I still can't explain is that the "Cell Motion Detection" and "Motion Alarm" sensors, among others, are no longer provided. "This entity is no longer provided by the tapo_control integration. If the entity is no longer used, delete it in the settings." But maybe it is still due to a setting that I did unconsciously.
Thank you for reporting back. That is explained in faq in readme.
I got similar issue with latest version of firmware. When I tried to remove everything and add it all back, my cameras with .7 version were added fine, but with .9 version I can't even authenticate get the following error: Invalid authentication data. Make sure you have created your 3rd party account via Tapo app. You can also test if these credentials work via rtsp stream, for example VLC using link rtsp://username:password@IP Address:554/stream1.
I even tried with VLC to run the stream also same issue. but my Tapo app, Agent DVR and Synology Surveillance working fine.
Wrong issue. You are entering wrong rtsp stream authentication data or are overloading the camera. Make sure camera is not used in too many places - there is a limit of 2 max concurrent streams, use correct password, restart things and try again.
Description
Hello.
Thank you for the new 5.4.0, but unfortunately I now have a new problem. Since 5.4.0, approx. 1 hour after rebooting the camera, almost all control elements are grayed out and can no longer be used and individual messages such as "Move down no longer available" appear in the logbook. This only affects the camera with SW 1.3.9. Movements are still detected in the HA logbook, but the camera can no longer be controlled. The camera is fully functional in the Tapo app. If I restart the camera by interrupting the power supply, the control elements are no longer grayed out and are functional again for approx. 1 hour. Two identical camera models with SW 1.3.7. do not show these problems.
Reproduction Steps
Expected behavior
Permanent availability of the controls
If applicable, add error logs.
Logger: homeassistant.components.camera Source: helpers/entity_platform.py:857 Integration: Kamera (documentation, issues) First occurred: 4. November 2023 um 23:10:47 (2581 occurrences) Last logged: 20:42:50
Updating tapo_control camera took longer than the scheduled update interval 0:00:30
Logger: homeassistant.components.camera Source: helpers/entity_platform.py:857 Integration: Kamera (documentation, issues) First occurred: 4. November 2023 um 23:10:47 (2581 occurrences) Last logged: 20:42:50
Updating tapo_control camera took longer than the scheduled update interval 0:00:30
Logger: custom_components.tapo_control Source: custom_components/tapo_control/utils.py:596 Integration: Tapo: Kamerasteuerung (documentation, issues) First occurred: 4. November 2023 um 23:08:21 (14722 occurrences) Last logged: 20:43:10
Authority failure
Logger: custom_components.tapo_control Source: custom_components/tapo_control/init.py:416 Integration: Tapo: Kamerasteuerung (documentation, issues) First occurred: 4. November 2023 um 23:14:23 (5808 occurrences) Last logged: 20:43:11
Device Firmware
1.3.9 Build 231019 Rel.13805n(4555)
Using stream component
Yes
Does camera work via official integrations?
Yes
Camera has all attributes filled out in developer tools
Yes
HASS Environment
home assistant intel nuc installation
Search for similar issues
Yes
Additional information
No response