panasonic_cc icon indicating copy to clipboard operation
panasonic_cc copied to clipboard

First 403 - Readded integration, Now: Errors Max Retries Exceeded

Open Nornode opened this issue 2 years ago • 4 comments

``I first got:

Logger: homeassistant.config_entries Source: custom_components/panasonic_cc/init.py:79 Integration: Panasonic Comfort Cloud (documentation) First occurred: 10:02:54 (1 occurrences) Last logged: 10:02:54

Error setting up entry for panasonic_cc Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/panasonic_cc/__init__.py", line 79, in async_setup_entry
    devices = await hass.async_add_executor_job(api.get_devices)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 172, in get_devices
    self.login()
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 99, in login
    self._create_token()
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 132, in _create_token
    raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>

I readded the integration through the UI. - It worked, I choose the area for both heatpumps.

No HA log is spammed with:


Traceback (most recent call last):
  File "/config/custom_components/panasonic_cc/panasonic.py", line 21, in wrapper_call
    func(*args, **kwargs)
  File "/config/custom_components/panasonic_cc/panasonic.py", line 346, in set_device
    self._api.set_device(
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 392, in set_device
    raise RequestError(ex)
pcomfortcloud.session.RequestError: HTTPSConnectionPool(host='accsmart.panasonic.com', port=443): Max retries exceeded with url: /deviceStatus/control (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7efdf0bbc820>: Failed to establish a new connection: [Errno -2] Name does not resolve'))

During handling of the above exception, another exception occurred:

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 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve

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 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 358, 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.HTTPSConnection object at 0x7efdf0acca00>: Failed to establish a new connection: [Errno -2] Name does not resolve

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 440, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='accsmart.panasonic.com', port=443): Max retries exceeded with url: /auth/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7efdf0acca00>: Failed to establish a new connection: [Errno -2] Name does not resolve'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 130, in _create_token
    response = requests.post(urls.login(), json=payload, headers=self._headers(), verify=self._verifySsl)
  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 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='accsmart.panasonic.com', port=443): Max retries exceeded with url: /auth/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7efdf0acca00>: Failed to establish a new connection: [Errno -2] Name does not resolve'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1654, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1673, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 668, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 949, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 705, in _handle_entity_call
    await result
  File "/config/custom_components/panasonic_cc/climate.py", line 75, in async_turn_off
    await self._api.turn_off()
  File "/config/custom_components/panasonic_cc/panasonic.py", line 227, in turn_off
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/panasonic_cc/panasonic.py", line 23, in wrapper_call
    args[0]._api.login()
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 99, in login
    self._create_token()
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 135, in _create_token
    raise LoginError(ex)
pcomfortcloud.session.LoginError: HTTPSConnectionPool(host='accsmart.panasonic.com', port=443): Max retries exceeded with url: /auth/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7efdf0acca00>: Failed to establish a new connection: [Errno -2] Name does not resolve'))

Are we being locked out from pmcomfortcloud?

Nornode avatar Apr 07 '22 07:04 Nornode

Responding to myself. Seems like the above is due to a rate limit on Panasonic side. I'm trying to e.g. turn off heatpump if door is open in node-red.

Seems like a rate limit och "change settings" towards the cloud would be good in this case.

So, feature request: -> Add rate limit as automation will kill the API and make the integration fail an in extent make home assistant unstable

Nornode avatar Apr 18 '22 18:04 Nornode

Did you find a solution? I also have this problem.

Th0masDB avatar Jul 13 '22 11:07 Th0masDB

Responding to myself. Seems like the above is due to a rate limit on Panasonic side. I'm trying to e.g. turn off heatpump if door is open in node-red.

Seems like a rate limit och "change settings" towards the cloud would be good in this case.

So, feature request: -> Add rate limit as automation will kill the API and make the integration fail an in extent make home assistant unstable

Yeah this was my "solution". In nodered, it's easy to have multiple changes in a very short time...

Nornode avatar Jul 13 '22 15:07 Nornode

Thanks! You should check also #76 . It has also to do with pmcomfortcloud.

Th0masDB avatar Jul 13 '22 18:07 Th0masDB