fishbigger / HomeAssistant-Tapo-P100-Control

A custom integration for home assistant to control the Tapo P100 plugs
MIT License
208 stars 69 forks source link

Possibly invalid credential/multiple plug/firmware issues #45

Open ErCanotta opened 2 years ago

ErCanotta commented 2 years ago

Hi, I bought 4 Tapo P100 plugs. During app configuration I updated firmware version on latest (1.4.9 Build 20210621 Rel.30941) for 3/4 of my plugs. After this I've used your custom component in home assistant following your guide (copying folder and writing configuration.yaml). Now the only plug recognized in home assistant is the one with old firmware version (1.2.10 Build 20210207 Rel. 67438).

Now do you think it is an issue with firmware? Or it is due to multiple plugs? I tried also to reset plugs, change password to 8 characters, remove and re add plugs, but with no lucky.

Please help me in troubleshoot.

This is the logs I can see in homeassistant (multiplied by 3 plugs):

_Logger: custom_components.tapo_p100_control.switch Source: custom_components/tapo_p100_control/switch.py:42 Integration: tapo_p100_control (documentation, issues) First occurred: 23:40:47 (3 occurrences) Last logged: 23:40:54

Could not connect to plug. Possibly invalid credentials_

_Logger: homeassistant.components.switch Source: custom_components/tapo_p100_control/switch.py:83 Integration: Interruttore (documentation, issues) First occurred: 23:40:50 (3 occurrences) Last logged: 23:40:57

Error while setting up tapo_p100_control platform for switch Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn conn = connection.create_connection( File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 96, in create_connection raise err File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 86, in create_connection sock.connect(sa) OSError: [Errno 113] Host is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 234, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.8/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.8/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.8/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.8/http/client.py", line 1010, in _send_output self.send(msg) File "/usr/local/lib/python3.8/http/client.py", line 950, in send self.connect() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 200, in connect conn = self._new_conn() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xab535d48>: Failed to establish a new connection: [Errno 113] Host is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.143', port=80): Max retries exceeded with url: /app (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xab535d48>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 205, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/tapo_p100_control/switch.py", line 44, in setup_platform add_entities([P100Plug(p100)]) File "/config/custom_components/tapo_p100_control/switch.py", line 53, in init self.update() File "/config/custom_components/tapo_p100_control/switch.py", line 83, in update self._p100.handshake() File "/usr/local/lib/python3.8/site-packages/PyP100/PyP100.py", line 114, in handshake r = requests.post(URL, json=Payload) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 119, in post return request('post', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, sendkwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.143', port=80): Max retries exceeded with url: /app (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xab535d48>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

DrSpaldo commented 2 years ago

Looks like I am also getting the same issue. I have just purchased the plug and never tried the integration before, so I'm not sure what working looks like...

Logger: homeassistant.components.switch
Source: custom_components/tapo_p100_control/switch.py:83
Integration: Switch (documentation, issues)
First occurred: 22:20:39 (1 occurrences)
Last logged: 22:20:39

Error while setting up tapo_p100_control platform for switch
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
    raise err
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
    sock.connect(sa)
OSError: [Errno 113] Host is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/local/lib/python3.9/http/client.py", line 1279, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1325, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1274, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1034, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.9/http/client.py", line 974, in send
    self.connect()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fa162682850>: Failed to establish a new connection: [Errno 113] Host is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.122', port=80): Max retries exceeded with url: /app (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa162682850>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tapo_p100_control/switch.py", line 44, in setup_platform
    add_entities([P100Plug(p100)])
  File "/config/custom_components/tapo_p100_control/switch.py", line 53, in __init__
    self.update()
  File "/config/custom_components/tapo_p100_control/switch.py", line 83, in update
    self._p100.handshake()
  File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 114, in handshake
    r = requests.post(URL, json=Payload)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.122', port=80): Max retries exceeded with url: /app (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa162682850>: Failed to establish a new connection: [Errno 113] Host is unreachable'))
fishbigger commented 2 years ago

Can you check if the ip of the plug is correct?

raptr569 commented 2 years ago

I've also had this issue, exact same error on the latest firmware for the P100 running the latest version of HA.

I use a static IP for both switches so definitely the correct IPs.