petretiandrea / home-assistant-tapo-p100

A custom integration to control Tapo devices from home assistant.
MIT License
818 stars 102 forks source link

cannot connect h200 #578

Closed raoul170 closed 4 months ago

raoul170 commented 1 year ago

Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.tapo.config_flow Source: custom_components/tapo/config_flow.py:118 Integration: TP-Link Tapo (documentation, issues) First occurred: 16:39:26 (1 occurrences) Last logged: 16:39:26

Failed to setup cannot connect Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') TimeoutError: [Errno 110] Connect call failed ('193.168.178.241', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 215, in _try_setup_api await client.initialize() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 62, in initialize await self._guess_protocol() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 218, in _guess_protocol response = await self.execute_raw_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 71, in execute_raw_request return (await self._protocol.send_request(request)).map(lambda x: x.result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 42, in send_request response = await self._send_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 62, in _send_request await self._login_with_version(self._credential) File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 81, in _login_with_version session_or_error = await self._passthrough.handshake(self._url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake response = await self._http.async_make_post(url, json=request_body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post async with self.session.post( File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1178, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 193.168.178.241:80 ssl:default [Connect call failed ('193.168.178.241', 80)]

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 118, in async_step_user tapo_client = await self._try_setup_api(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo/config_flow.py", line 220, in _try_setup_api raise CannotConnect from error custom_components.tapo.errors.CannotConnect

antstyl commented 1 year ago

Same problem with me.

"Unknown error occurred" when trying to add h200.

H200 hub connects successfully through Tapo camera control integration.

pektommy commented 1 year ago

H200 won't connect for me, Error message: "Failed to connect"

2023-10-20 19:33:06.876 ERROR (MainThread) [custom_components.tapo.config_flow] Failed to setup cannot connect Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 211, in _try_setup_api host, port = get_host_port(user_input[CONF_HOST]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo/setup_helpers.py", line 131, in get_host_port return (parts[0], int(parts[1])) ^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: '62:8b:0a:23:7f'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 118, in async_step_user tapo_client = await self._try_setup_api(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo/config_flow.py", line 220, in _try_setup_api raise CannotConnect from error custom_components.tapo.errors.CannotConnect

antstyl commented 1 year ago

I got the following from debugging:

`2023-10-19 11:37:52.550 ERROR (MainThread) [custom_components.tapo.coordinators] Error fetching tapo data: Unexpected exception:

2023-10-19 11:48:12.550 ERROR (MainThread) [custom_components.tapo.coordinators] Error fetching tapo data: Unexpected exception:

2023-10-19 11:56:12.575 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.027 seconds (success: True)

2023-10-19 11:56:14.057 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.334 seconds (success: True)

2023-10-19 11:56:32.960 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.028 seconds (success: True)

2023-10-19 11:56:36.638 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.029 seconds (success: True)

2023-10-19 11:56:36.774 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.032 seconds (success: True)

2023-10-19 11:56:42.578 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.029 seconds (success: True)

2023-10-19 11:56:43.761 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.038 seconds (success: True)

2023-10-19 11:57:02.972 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.038 seconds (success: True)

2023-10-19 11:57:06.648 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.039 seconds (success: True)

2023-10-19 11:57:06.772 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.031 seconds (success: True)

2023-10-19 11:57:12.577 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.029 seconds (success: True)

2023-10-19 11:57:13.761 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.038 seconds (success: True)

2023-10-19 11:57:32.971 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.038 seconds (success: True)

2023-10-19 11:57:36.646 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.037 seconds (success: True)

2023-10-19 11:57:36.771 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.029 seconds (success: True)

2023-10-19 11:57:43.762 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.039 seconds (success: True)

2023-10-19 11:57:52.551 ERROR (MainThread) [custom_components.tapo.coordinators] Error fetching tapo data: Unexpected exception:

2023-10-19 11:57:52.551 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 10.001 seconds (success: False)

2023-10-19 11:58:02.971 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.039 seconds (success: True)

2023-10-19 11:58:06.655 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.046 seconds (success: True)

2023-10-19 11:58:06.779 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.038 seconds (success: True)`

xFranklin7 commented 1 year ago

H200 non si connette per me, messaggio di errore: "Impossibile connettersi"

Same problem.

pektommy commented 1 year ago

H200 non si connette per me, messaggio di errore: "Impossibile connettersi"

Same problem.

Has anyone managed to connect? :)

petretiandrea commented 1 year ago

62:8b:0a:23:7f

Why are you using something like mac address as host?

petretiandrea commented 1 year ago

'193.168.178.241'

Is this a local ip address '193.168.178.241'?

xFranklin7 commented 1 year ago

This is my log.

2023-10-28 12:43:15.608 ERROR (MainThread) [custom_components.tapo.config_flow] Failed to setup cannot connect Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') TimeoutError: [Errno 110] Connect call failed ('192.168.1.18', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 215, in _try_setup_api await client.initialize() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 62, in initialize await self._guess_protocol() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 218, in _guess_protocol response = await self.execute_raw_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 71, in execute_raw_request return (await self._protocol.send_request(request)).map(lambda x: x.result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 42, in send_request response = await self._send_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 62, in _send_request await self._login_with_version(self._credential) File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 81, in _login_with_version session_or_error = await self._passthrough.handshake(self._url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake response = await self._http.async_make_post(url, json=request_body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post async with self.session.post( File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1178, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.18:80 ssl:default [Connect call failed ('192.168.1.18', 80)]

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 118, in async_step_user tapo_client = await self._try_setup_api(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo/config_flow.py", line 220, in _try_setup_api raise CannotConnect from error custom_components.tapo.errors.CannotConnect

raoul170 commented 1 year ago

'193.168.178.241'

Is this a local ip address '193.168.178.241'?

yes local

johannijs commented 1 year ago

same error

Deze fout is ontstaan door een aangepaste integratie. Logger: custom_components.tapo.config_flow Source: custom_components/tapo/config_flow.py:118 Integration: TP-Link Tapo (documentation, issues) First occurred: 21:09:37 (1 occurrences) Last logged: 21:09:37

Failed to setup cannot connect Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') TimeoutError: [Errno 110] Connect call failed ('192.168.10.70', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 215, in _try_setup_api await client.initialize() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 62, in initialize await self._guess_protocol() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 218, in _guess_protocol response = await self.execute_raw_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 71, in execute_raw_request return (await self._protocol.send_request(request)).map(lambda x: x.result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 42, in send_request response = await self._send_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 62, in _send_request await self._login_with_version(self._credential) File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 81, in _login_with_version session_or_error = await self._passthrough.handshake(self._url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake response = await self._http.async_make_post(url, json=request_body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post async with self.session.post( File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1178, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.10.70:80 ssl:default [Connect call failed ('192.168.10.70', 80)]

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 118, in async_step_user tapo_client = await self._try_setup_api(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo/config_flow.py", line 220, in _try_setup_api raise CannotConnect from error custom_components.tapo.errors.CannotConnect

DennisdeBest commented 11 months ago

Same for me so far the H200 can not connect. H200 firmware : 1.2.23 home-assistant-p100 : 2.11 HomeAssistant : 2023.11.0

junyan-rippling commented 11 months ago

same here. It tries to connect 80 port, but camera 80 port is closed. 443 is open

boheme61 commented 11 months ago

Same here

H200 firmware : 1.2.23 home-assistant-p100 : 2.11 Core : 2023.11.2 Supervisor: 2023.11.3 OS 11.1

Nothing new to add !, same errors :(

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.50.21:80 ssl:default [Connect call failed ('192.168.50.21', 80)]

not that i know why it's an ... :80 ssl:default

PS: Lately Tapo have push out updates, with "improved security", The Tapo-Camera-Control by JurajNyiri , has been busy keeping up with "patches/fixes" , maybe this is caused by the same, as Tapo both updated their App, and the H200 resently

1.2.23 Build 20231012 rel.49638

EDIT:

File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.50.21:80 ssl:default [Connect call failed ('192.168.50.21', 80)] The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 118, in async_step_user tapo_client = await self._try_setup_api(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo/config_flow.py", line 220, in _try_setup_api raise CannotConnect from error

Currently trying to DEBUG , but there seems to be nothing to DEBUG ... Below is all there is,

2023-11-16 18:45:58.315 ERROR (MainThread) [custom_components.tapo.config_flow] Failed to setup cannot connect Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') TimeoutError: [Errno 110] Connect call failed ('192.168.50.21', 80) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 215, in _try_setup_api await client.initialize() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 62, in initialize await self._guess_protocol() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 235, in _guess_protocol response = await self.execute_raw_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 71, in execute_raw_request return (await self._protocol.send_request(request)).map(lambda x: x.result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 42, in send_request response = await self._send_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 62, in _send_request await self._login_with_version(self._credential) File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 81, in _login_with_version session_or_error = await self._passthrough.handshake(self._url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake response = await self._http.async_make_post(url, json=request_body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post async with self.session.post( File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1178, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.50.21:80 ssl:default [Connect call failed ('192.168.50.21', 80)] The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 118, in async_step_user tapo_client = await self._try_setup_api(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo/config_flow.py", line 220, in _try_setup_api raise CannotConnect from error custom_components.tapo.errors.CannotConnect

I'll try with "custom_components.tapo.config_flow"

irsl commented 11 months ago

Tapo has released a new authentication flow recently. It is advertised as encrypt_type: 3. In short, they turned to using a challenge response protocol to address security issues. Context here:

https://docs.google.com/presentation/d/1zdG803ZWzpvpM0LFUE-MU2lusrOALOAaroGsQ9dj42Y/edit#slide=id.p

petretiandrea commented 11 months ago

Hi guys, to fix issue with h200 I need someone runs this python script, and report here the output

import asyncio
import os

from plugp100.api.hub.hub_device import HubDevice
from plugp100.api.light_effect_preset import LightEffectPreset
from plugp100.api.tapo_client import TapoClient
from plugp100.common.credentials import AuthCredential

async def main():
    # create generic tapo api
    username = os.getenv("USERNAME", "<tapo_email>")
    password = os.getenv("PASSWORD", "<tapo_password>")

    credentials = AuthCredential(username, password)
    client = TapoClient(credentials, "<tapo_device_ip>")

    print(await client.get_device_info())
    print(await client.get_child_device_list())
    print(await client.get_child_device_component_list())

if __name__ == "__main__":
    loop = asyncio.new_event_loop()
    loop.run_until_complete(main())
    loop.run_until_complete(asyncio.sleep(0.1))
    loop.close()
hiltonhowie commented 11 months ago

Hi, I can help but not sure where to save this script on HA and how to run it? I have an H200 and HA installed with terminal access.

boheme61 commented 11 months ago

I can " join in " but as you , i have no idea what and howto :)

prepared by adding in config.yaml


logger:
  default: info
  logs:
     custom_components.tapo: debug

debugpy:
  start: true
  wait: false

ohh-well , with right indentations ofcause

@hiltonhowie

save it as " something.py " and copy it to /custom_components/tapo

petretiandrea commented 11 months ago

You must create a python file, like main.py and then run python main.py. You can run It on same HA machine

boheme61 commented 11 months ago

dont know how to "make it run in studio-code-s , does it work to run in terminal ?

➜  /config cd custom_components/tapo
➜  tapo python tapodebug.py
Traceback (most recent call last):
  File "/homeassistant/custom_components/tapo/tapodebug.py", line 4, in <module>
    from plugp100.api.hub.hub_device import HubDevice
ModuleNotFoundError: No module named 'plugp100'

do i have to "initiate" the setup of H200 , and then run python fil.py ?

boheme61 commented 11 months ago

hmmm wait, am i in the wrong "issue" here ? , i thought this was about to setup H200 in the integration

Not about ... LightEffectPreset

It's the H200 which will not "integrate", cannot connect to ...:80 ssl:default (Ip of the HUB itself)

This happens during setup of the H200, as atleast 5 of above having issues with, after filling in info and clicking submit, it just "spins" until abort and final errors

PS: I think yo got "deceived " by post 3 , as all other seems to have issues connecting H200

EDIT: I can add the H200 in Tapo_camera_controller but immediately get errors , most likely do to the fact i don't have any Cams in this Hub

AshleyJackson commented 11 months ago

On my HA Yellow.

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.11/asyncio/selector_events.py", line 634, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/selector_events.py", line 674, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('192.168.88.77', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/gh_test.py", line 26, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/root/gh_test.py", line 17, in main
    await client.initialize()
  File "/usr/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 62, in initialize
    await self._guess_protocol()
  File "/usr/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 235, in _guess_protocol
    response = await self.execute_raw_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 71, in execute_raw_request
    return (await self._protocol.send_request(request)).map(lambda x: x.result)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 42, in send_request
    response = await self._send_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 62, in _send_request
    await self._login_with_version(self._credential)
  File "/usr/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 81, in _login_with_version
    session_or_error = await self._passthrough.handshake(self._url)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake
    response = await self._http.async_make_post(url, json=request_body)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post
    async with self.session.post(
  File "/usr/lib/python3.11/site-packages/aiohttp/client.py", line 1187, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/aiohttp/client.py", line 574, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/aiohttp/connector.py", line 1231, in _create_direct_connection
    raise last_exc
  File "/usr/lib/python3.11/site-packages/aiohttp/connector.py", line 1200, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/aiohttp/connector.py", line 996, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.88.77:80 ssl:default [Connect call failed ('192.168.88.77', 80)]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fb9d47350>
petretiandrea commented 11 months ago

dont know how to "make it run in studio-code-s , does it work to run in terminal ?

➜  /config cd custom_components/tapo
➜  tapo python tapodebug.py
Traceback (most recent call last):
  File "/homeassistant/custom_components/tapo/tapodebug.py", line 4, in <module>
    from plugp100.api.hub.hub_device import HubDevice
ModuleNotFoundError: No module named 'plugp100'

do i have to "initiate" the setup of H200 , and then run python fil.py ?

Install plugp100 by pip install plugp100

johannijs commented 11 months ago

Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection raise exceptions[0] File "/usr/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/lib/python3.11/asyncio/selector_events.py", line 634, in sock_connect return await fut ^^^^^^^^^ File "/usr/lib/python3.11/asyncio/selector_events.py", line 674, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') TimeoutError: [Errno 110] Connect call failed ('192.168.10.70', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/homeassistant/tapo.py", line 26, in loop.run_until_complete(main()) File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/homeassistant/tapo.py", line 17, in main await client.initialize() File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 62, in initialize await self._guess_protocol() File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 235, in _guess_protocol response = await self.execute_raw_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 71, in execute_raw_request return (await self._protocol.send_request(request)).map(lambda x: x.result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 42, in send_request response = await self._send_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 62, in _send_request await self._login_with_version(self._credential) File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 81, in _login_with_version session_or_error = await self._passthrough.handshake(self._url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake response = await self._http.async_make_post(url, json=request_body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post async with self.session.post( File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 1187, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 574, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 907, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1231, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1200, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 996, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.10.70:80 ssl:default [Connect call failed ('192.168.10.70', 80)] Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7f1aefe02810>

boheme61 commented 11 months ago

Got it

➜  tapo python main.py      
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1169, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 880, in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 867, in getaddrinfo
    return await self.run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/homeassistant/custom_components/tapo/main.py", line 26, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/homeassistant/custom_components/tapo/main.py", line 17, in main
    await client.initialize()
  File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 62, in initialize
    await self._guess_protocol()
  File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 235, in _guess_protocol
    response = await self.execute_raw_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 71, in execute_raw_request
    return (await self._protocol.send_request(request)).map(lambda x: x.result)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 42, in send_request
    response = await self._send_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 62, in _send_request
    await self._login_with_version(self._credential)
  File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 81, in _login_with_version
    session_or_error = await self._passthrough.handshake(self._url)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake
    response = await self._http.async_make_post(url, json=request_body)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post
    async with self.session.post(
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 1187, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 574, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1183, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host <tapo_device_ip>:80 ssl:default [Name or service not known]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fcd7c7ea590>

Above is before trying to add the Hub

boheme61 commented 11 months ago

PS: i run HA "internal" (http), no https-portforwarding-or reverse-proxy or the likes

And the hub is working, over the android-tapo-app, and added as a device-tracker in asus.integration

boheme61 commented 11 months ago

And this is the trace from trying to setup Hub using host-name, instead of IP

EDIT: when using hostname, the "process" is "done" within few seconds, and the "trace" is thrown ... when using ip, it takes a minute or so, before it "abort" and throw the "trace"

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1155, in _create_direct_connection hosts = await asyncio.shield(host_resolved) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 874, in _resolve_host addrs = await self._resolver.resolve(host, port, family=self._family) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/resolver.py", line 33, in resolve infos = await self._loop.getaddrinfo( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 867, in getaddrinfo return await self.run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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/socket.py", line 962, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno -5] Name has no usable address The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 215, in _try_setup_api await client.initialize() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 62, in initialize await self._guess_protocol() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 218, in _guess_protocol response = await self.execute_raw_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 71, in execute_raw_request return (await self._protocol.send_request(request)).map(lambda x: x.result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 42, in send_request response = await self._send_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 62, in _send_request await self._login_with_version(self._credential) File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 81, in _login_with_version session_or_error = await self._passthrough.handshake(self._url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake response = await self._http.async_make_post(url, json=request_body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post async with self.session.post( File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1169, in _create_direct_connection raise ClientConnectorError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host h200:80 ssl:default [Name has no usable address] The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 118, in async_step_user tapo_client = await self._try_setup_api(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo/config_flow.py", line 220, in _try_setup_api raise CannotConnect from error custom_components.tapo.errors.CannotConnect

boheme61 commented 11 months ago

Here is the trace from trying to setup with IP

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
sock = await self._connect_sock(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect
return await fut
^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('192.168.50.21', 80)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/tapo/config_flow.py", line 215, in _try_setup_api
await client.initialize()
File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 62, in initialize
await self._guess_protocol()
File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 218, in _guess_protocol
response = await self.execute_raw_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 71, in execute_raw_request
return (await self._protocol.send_request(request)).map(lambda x: x.result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 42, in send_request
response = await self._send_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 62, in _send_request
await self._login_with_version(self._credential)
File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 81, in _login_with_version
session_or_error = await self._passthrough.handshake(self._url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake
response = await self._http.async_make_post(url, json=request_body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post
async with self.session.post(
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in __aenter__
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.50.21:80 ssl:default [Connect call failed ('192.168.50.21', 80)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/tapo/config_flow.py", line 118, in async_step_user
tapo_client = await self._try_setup_api(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tapo/config_flow.py", line 220, in _try_setup_api
raise CannotConnect from error
custom_components.tapo.errors.CannotConnect
boheme61 commented 11 months ago

First i should say, i have no deep knowledge in either HA, or this integration, but i have seen quite alot "issues" lately related to "network/resolve" , and also know there past months has been "some" remodeling at the OS and Supervisor level, in regards to HA's Network manager etc. ... I obviously have no idea whether this can be related, just thought i would mention it , examples below is related to the HA-Host it self, i believe https://github.com/home-assistant/supervisor/pull/4476 https://github.com/home-assistant/operating-system/pull/2763/commits

But i noticed in "tapo-hub.py"

49            config_entry_id=self.entry.entry_id,
50            connections={(device_registry.CONNECTION_NETWORK_MAC, device_info.mac)}

MAC seems no longer being used in the ./storage/core.device_registry ( Maybe Host-Name is used now ) ... which is a pity, i try my best to use IP and/or MAC-binding to avoid mdns/dns as much as possible

Again, i have no idea how this "inferno" of HA and integrations/add-ons works ... but i like it :)

hiltonhowie commented 11 months ago

I have a similar output to boheme61 and its trying to connect on port 80. I can confirm a port check to the H200 shows a result of not listening on port 80. It is listening on port 443

1

boheme61 commented 11 months ago

yeah , i also had this in my mind, but i couldn't figure out how to "listen", i tried with wireshark, but had no idea howto, and didn't know howto "remote sniffing" HA as im running in VMware on Debian, So if you have a good(easy to understand) tutorial to recommend, id be happy ... well i didn't try hard trying to figure it out, i been readin Changelogs and pull-requests instead : ))

hiltonhowie commented 11 months ago

I just used netcat to test port 80 and port 443 on the target H200. 443 connects and 80 times out

boheme61 commented 11 months ago

confirmed ! , thou it doesn't explain the errors

socket.gaierror: [Errno -2] Name or service not known socket.gaierror: [Errno -5] Name has no usable address

But maybe thats just because the Hub haven't been registered in "core.device_registry" Thou these errors don't occur using IP, in the setup, it's when using host-name

And "Name has no "address" in the "core.device_registry"

In config_flow , these are imported from "const"

CONF_HOST = "host" CONF_MAC = "mac"

but neither IP-number , nor MAC is registered in core.device_registry for any Devices in this integration, so i wonder what's happening when these are called in "config_entries"

Anyways, it obvious doesn't get that far, as it doesn't seems communicate over post 80 unless " 192.168.50.21:80 ssl:default " means it should default/fallback to ssl, if it doesn't succeed on 80

boheme61 commented 11 months ago

well i forgot, i "installed" plugg100, prior to getting this gaie-info :)

This is what /plugp100/api/tapo_client.py does

class TapoClient:
    def __init__(
        self,
        auth_credential: AuthCredential,
        ip_address: str,
        port: Optional[int] = 80,
        http_session: Optional[aiohttp.ClientSession] = None,
        protocol_type: TapoProtocolType = TapoProtocolType.AUTO,
    ):
        self._auth_credential = auth_credential
        self._ip_address = ip_address
        self._port = port
        self._http_session = http_session
        self._protocol_type = protocol_type
        self._protocol: Optional[TapoProtocol] = None

    async def initialize(self):
        if self._protocol_type == TapoProtocolType.KLAP:
            self._protocol = KlapProtocol(
                auth_credential=self._auth_credential,
                host=self._ip_address,
                port=self._port,
                http_session=self._http_session,
            )
        elif self._protocol_type == TapoProtocolType.PASSTHROUGH:
            self._protocol = PassthroughProtocol(
                auth_credential=self._auth_credential,
                host=self._ip_address,
                port=self._port,
                http_session=self._http_session,
            )
        else:
            await self._guess_protocol()

    async def close(self):
        await self._protocol.close()
petretiandrea commented 11 months ago

I just used netcat to test port 80 and port 443 on the target H200. 443 connects and 80 times out

This is really interesting, the tapo library communicate over http. I will release a new version of api to test the same code snippets but using https

petretiandrea commented 11 months ago

Alternatively you can form my library edits python code and try to communicate over https (443) and try if it wokrs

boheme61 commented 11 months ago

" Alternatively you can form my library edits python code and try to communicate over https (443) and try if it wokrs "

:)) im absolutely no "coder" , i just try to understand codes ... and with an IT background i like to truobleshoot So my "findings is pure speculations, as i have no idea how things works actually ... just trying to understand

I was thinking about running an "edited" versions of tapo_client.py , but as i dont know what happens where and when i didn't wanna break all, with some "ideas" :))

Beside the last "info" client.py/connector.py is from the OS /or Core i guess, but which 1, there are about a dozen, in "aiohttp" there are 4 diff/merged , have no idea which belongs to what.

However, im here, and if you find something, i can test , my initial thoughts are it's the Damn firmware updates, i have now disable auto-updates for all my Tapo-device :) , started when the Tapo-Cams got these "enhanced security" fixes ( most likely to prevent us from using other software/apps to use the devices in ... but that's my thoughts :))

@petretiandrea , i just wondered if your above commend was mend sarcastic, i sincerely dont hope i have "offended you in any way, by my commends and "poking around" in your code, as mentioned above, im a total noob, and would never be able to create an integration or any kind of apps/programs , And i have never had any issues with Your Tapo integration, i have 9 plugs, 4 with power-meter, and 2 multicolored light-strips, working flawless for about 2 years and still. I just recently bought this H200 and a bunch of sensors, with this only purpose( and because i noticed it was supported here ), ... sadly i was "forced" to update the firmware in both the Hub, and App, to be able to pair it with the App, ( maybe this is the reason, thou i can only see 1 other above mentioning firmware-version )

petretiandrea commented 11 months ago

Don't worry I'm editing code to allows 443, so I will release a new version of plugp100, but I need someone test my changes, cause I don't have h200 physically

boheme61 commented 11 months ago

i can test, thou i already "reverted" my test-unit, after installing the plugp100, but i'll do another "round" PS: i'ts on latest core 2023.11.3 now, but i guess that doesn't matter

voloda22 commented 11 months ago

I am experiencing the same problem with H200 and "Failed to connect" error. In the log there is also the known message about the unsuccessful connection on the port 80. I can help with the testing as well once changed to the port 443.

au51gtm commented 11 months ago

I have the same issue in that I get the 'Failed to Connect' error when trying to add an H200 Hub. How are things progressing with the correction of this issue?

petretiandrea commented 11 months ago

Ok, I have been release a new version of plugp100 to try new https. So please install lastest version of plugp100 by pip install plugp100==3.14.0 and then edit my previous script by api = TapoClient.create(credentials, <address>, 443, True) the last flag (True) will enable https

johannijs commented 11 months ago

This is with the updated plugp100 and with this Edit in the .py file client = TapoClient.create(credentials, "192.168.10.70", 443, True)

Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/base_events.py", line 1112, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/base_events.py", line 1145, in _create_connection_transport await waiter File "/usr/lib/python3.11/asyncio/sslproto.py", line 574, in _on_handshake_complete raise handshake_exc File "/usr/lib/python3.11/asyncio/sslproto.py", line 556, in _do_handshake self._sslobj.do_handshake() File "/usr/lib/python3.11/ssl.py", line 979, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:992)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/homeassistant/tapo.py", line 38, in loop.run_until_complete(main()) File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/homeassistant/tapo.py", line 17, in main await client.initialize() File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 70, in initialize await self._guess_protocol() File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 247, in _guess_protocol response = await self.execute_raw_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 79, in execute_raw_request return (await self._protocol.send_request(request)).map(lambda x: x.result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 41, in send_request response = await self._send_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 61, in _send_request await self._login_with_version(self._credential) File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 80, in _login_with_version session_or_error = await self._passthrough.handshake(self._url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake response = await self._http.async_make_post(url, json=request_body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post async with self.session.post( File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 1187, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 574, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 907, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1231, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1200, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 990, in _wrap_create_connection raise ClientConnectorCertificateError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host 192.168.10.70:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:992)')] Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7fea15d0f9d0>

boheme61 commented 11 months ago

Maybe i don't know what im doing, well i dont :) ... and here is my result

➜  tapo python main.py
Traceback (most recent call last):
  File "/homeassistant/custom_components/tapo/main.py", line 26, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/homeassistant/custom_components/tapo/main.py", line 16, in main
    TapoClient.create(credentials, "192.168.50.21", 443, True)
  File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 39, in create
    url = f"{'https' if is_https else 'http'}://{address}:{port}/app"
                        ^^^^^^^^
NameError: name 'is_https' is not defined
boheme61 commented 11 months ago

Thing i "figured it out! got similar result as johannijs above ... after also installing Release 2.12.0

➜  tapo python main1.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1112, in create_connection
    transport, protocol = await self._create_connection_transport(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1145, in _create_connection_transport
    await waiter
  File "/usr/lib/python3.11/asyncio/sslproto.py", line 574, in _on_handshake_complete
    raise handshake_exc
  File "/usr/lib/python3.11/asyncio/sslproto.py", line 556, in _do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.11/ssl.py", line 979, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:992)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/homeassistant/custom_components/tapo/main1.py", line 28, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/homeassistant/custom_components/tapo/main1.py", line 19, in main
    await client.initialize()
  File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 70, in initialize
    await self._guess_protocol()
  File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 247, in _guess_protocol
    response = await self.execute_raw_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/api/tapo_client.py", line 79, in execute_raw_request
    return (await self._protocol.send_request(request)).map(lambda x: x.result)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 41, in send_request
    response = await self._send_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 61, in _send_request
    await self._login_with_version(self._credential)
  File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/passthrough_protocol.py", line 80, in _login_with_version
    session_or_error = await self._passthrough.handshake(self._url)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake
    response = await self._http.async_make_post(url, json=request_body)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post
    async with self.session.post(
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 1187, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 574, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 911, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1235, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1204, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 994, in _wrap_create_connection
    raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host 192.168.50.21:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:992)')]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f1f0418bc50>
au51gtm commented 11 months ago

Hi,

I updated to the new version but I still get the Failed Setup error message.

Details and the log file have been posted in GitHub. I hope it helps.

Regards,

Trevor.

On Mon, 27 Nov 2023, 21:55 petretiandrea, @.***> wrote:

Ok, I have been release a new version of plugp100 to try new https. So please install lastest version of plugp100 by pip install plugp100==3.14.0 and then edit my previous script by api = TapoClient.create(credentials,

, 443, True) the last flag (True) will enable https — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you commented.Message ID: ***@***.***>
boheme61 commented 11 months ago

PS: I've tried to "lower/raise" encryption , but neither works,below 512 said has to be above, and 4096 said the same as above, so, seems like it's really not "EE certificate" causes Maybe it's MD5 related, look at below "Issue", caused when Tapo-Cams got the new "encryption-model"
https://github.com/JurajNyiri/pytapo/pull/82/files BR

antstyl commented 11 months ago

is anything else we can do to test and help fixing this?

coochster commented 11 months ago

hi, I'm a noob running Home Assistant Green having H200 hub (Firmware 1.2.23) connect issues, let me know if I can do any testing, log below: Log details (ERROR)

This error originated from a custom integration. Logger: custom_components.tapo.config_flow Source: custom_components/tapo/config_flow.py:118 Integration: TP-Link Tapo (documentation, issues) First occurred: 3:24:01 PM (2 occurrences) Last logged: 3:36:19 PM

Failed to setup cannot connect Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') TimeoutError: [Errno 110] Connect call failed ('10.20.30.6', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 215, in _try_setup_api await client.initialize() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 70, in initialize await self._guess_protocol() File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 247, in _guess_protocol response = await self.execute_raw_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 79, in execute_raw_request return (await self._protocol.send_request(request)).map(lambda x: x.result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 41, in send_request response = await self._send_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 61, in _send_request await self._login_with_version(self._credential) File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/passthrough_protocol.py", line 80, in _login_with_version session_or_error = await self._passthrough.handshake(self._url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/securepassthrough_transport.py", line 70, in handshake response = await self._http.async_make_post(url, json=request_body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/common/utils/http_client.py", line 18, in async_make_post async with self.session.post( File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1187, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 574, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 544, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 911, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1235, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1000, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 10.20.30.6:80 ssl:default [Connect call failed ('10.20.30.6', 80)]

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 118, in async_step_user tapo_client = await self._try_setup_api(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo/config_flow.py", line 220, in _try_setup_api raise CannotConnect from error custom_components.tapo.errors.CannotConnect

petretiandrea commented 11 months ago

I need a volunteer to schedule a remote call or give me access to a device to try it

ndricjaho commented 11 months ago

I need a volunteer to schedule a remote call or give me access to a device to try it

I volunteer, I have the same problem and the device