JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
1.13k stars 89 forks source link

Bug: Tapo integration does not work properly when the IP address is a DDNS. #110

Closed jose3894 closed 2 years ago

jose3894 commented 3 years ago

Describe the bug The Tapo C200 camera can not work with Home Assistant if the camera is in different network than Home Assistant server. The ports (554, 443, 2020) are opened. The home assistant server can connect with the camera by rtsp.

To Reproduce Steps to reproduce the behavior:

  1. Try to create a new Tapo device with Tapo integration.
  2. Fill IP with your DDNS. Captura1
  3. Follow the steps and finish. Captura2
  4. The configuration will finish correctly. Captura3
  5. The integration does not create any device neither entity. Captura4 Captura5

Expected behavior The integration should create the device and entities but it does not make it.

Log Logger: custom_components.tapo_control Source: custom_components/tapo_control/init.py:253 Integration: Tapo: Cameras Control (documentation, issues) First occurred: 13:49:12 (5 occurrences) Last logged: 13:51:14

Unable to connect to Tapo: Cameras Control controller: All connection attempts failed

Captura6

Camera (please complete the following information):

Using stream component yes

Camera works through onvif component OR different cameras work in general yes, I have other cameras by Tapo integration in local network working but I can do the same with my external cameras.

Camera has all attributes filled out properly in developer tools yes, I have created an 3rd party account and others attributes.

HASS Environment Docker with portainer. HASS 2021.9.7 System health: version core-2021.0.7 Python version: 3.9.7 Linux 4.19.66-v7+ armv71 Raspbian 9

JurajNyiri commented 3 years ago

Integration does connection checks and multiple authentication and other checks during gathering the data,it is interesting that all those suceed and then it doesn't work.

I am not sure how to replicate this. Is it a camera which is outside your network with opened ports to the internet?

jose3894 commented 3 years ago

The architecture is as follows: 134932975-37d44859-d354-4fd6-a8b0-209fb26a8d30

yes, there is a camera outside of home assistant network with open ports to the internet. I don't know if this is good architecture but it is the only way that I found. if you want you can suggest any other.

I made some connection tests with your library pytapo (test_pytapo.py) and it works! but the integration with home assistant doesn't.

JurajNyiri commented 2 years ago

Sorry I didn't get back to you sooner. If connection succeeds with pytapo and not with Home Assistant, it means that your Home Assistant environment cannot access the camera for some reason. Integration does support hostname instead of IP so that shouldn't be an issue.

In any case, this seems like a network misconfiguration and not integration issue so I will close this. Please feel free to come to discord, I can help you debug your network there further.