sockless-coding / panasonic_cc

Panasonic Comfort Cloud - Home Assistant Component
MIT License
130 stars 31 forks source link

Panasonic Comfort Cloud Unexpected error creating device. #250

Open antunespa opened 4 days ago

antunespa commented 4 days ago

The creating device error return, i have this message in log:

Bad logger message: Unexpected error creating device ((ResponseError('(get_acc_client_id: Expected status code 200, received: 401: <bound method ClientResponse.text of <ClientResponse(https://accsmart.panasonic.com/auth/v2/login) [401 Unauthorized]>\n<CIMultiDictProxy(\'Server\': \'CloudFront\', \'Date\': \'Thu, 04 Jul 2024 11:14:59 GMT\', \'Content-Length\': \'67\', \'Connection\': \'keep-alive\', \'Content-Type\': \'application/json\', \'X-Cache\': \'Error from cloudfront\', \'Via\': \'1.1 27a35654821ee52d8aa69c940ad5de7e.cloudfront.net (CloudFront)\', \'X-Amz-Cf-Pop\': \'LIS50-P1\', \'Alt-Svc\': \'h3=":443"; ma=86400\', \'X-Amz-Cf-Id\': \'vRJRwfGVAQOzelYrcrhX5tbjOI7lq8QZDCgTQKh5Tno0hSwnNqhMiw==\', \'X-XSS-Protection\': \'1; report=1;mode=block\', \'X-Frame-Options\': \'DENY\', \'Content-Security-Policy\': "script-src \'self\' \'unsafe-inline\'", \'X-Content-Type-Options\': \'nosniff\', \'Strict-Transport-Security\': \'max-age=31536000; includeSubDomains\')>\n>'),))

miksen commented 3 days ago

Having the same issue; logs:

Error setting up entry for panasonic_cc
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, 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.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/panasonic_cc/pcomfortcloud/session.py", line 207, in get_devices
    self.login()
  File "/config/custom_components/panasonic_cc/pcomfortcloud/session.py", line 106, in login
    self._create_token()
  File "/config/custom_components/panasonic_cc/pcomfortcloud/session.py", line 164, in _create_token
    raise ResponseError(response.status_code, response.text)
custom_components.panasonic_cc.pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Request blocked.
We can't connect to the server for this app or website at this time. 
There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: Zg_PDF8-EvcxZeyQmwKFScgpxchWfD7wYwv42rcQeHVfPw5F-mdFtQ==
sockless-coding commented 3 days ago

@antunespa Can you enable debug logging @miksen You need to update the integration, you are running an old version

miksen commented 3 days ago

Thanks @sockless-coding, updating and then re-adding resolved the issue for me.

antunespa commented 3 days ago

@antunespa Can you enable debug logging @miksen You need to update the integration, you are running an old version

I removed the integration and added again, now im trying to make the first login, i guess that this debug loggin option is possible only if i already have the integration added previously right?

sockless-coding commented 3 days ago

@antunespa No you can set the log level of any integration in the configuration.yaml By adding/editing the logger section

logger:
  logs:
    custom_components.panasonic_cc: debug
antunespa commented 3 days ago

logger: logs: custom_components.panasonic_cc: debug

I made the change and i only get this:

This error originated from a custom integration.

Logger: custom_components.panasonic_cc.config_flow Source: custom_components/panasonic_cc/config_flow.py:56 integration: Panasonic Comfort Cloud (documentation, issues) First occurred: 11:05:14 AM (2 occurrences) Last logged: 11:19:02 AM

Bad logger message: Unexpected error creating device ((ResponseError('(get_acc_client_id: Expected status code 200, received: 401: <bound method ClientResponse.text of <ClientResponse(https://accsmart.panasonic.com/auth/v2/login) [401 Unauthorized]>\n<CIMultiDictProxy(\'Server\': \'CloudFront\', \'Date\': \'Fri, 05 Jul 2024 10:05:14 GMT\', \'Content-Length\': \'67\', \'Connection\': \'keep-alive\', \'Content-Type\': \'application/json\', \'X-Cache\': \'Error from cloudfront\', \'Via\': \'1.1 89695f3a4a3f2f2d6df76a407130856e.cloudfront.net (CloudFront)\', \'X-Amz-Cf-Pop\': \'LIS50-C1\', \'Alt-Svc\': \'h3=":443"; ma=86400\', \'X-Amz-Cf-Id\': \'rf6XWKF5Nlg8sKAj2fZS6-BPDyFT99hXRLW3LM7buOyqIt-3HrfrhQ==\', \'X-XSS-Protection\': \'1; report=1;mode=block\', \'X-Frame-Options\': \'DENY\', \'Content-Security-Policy\': "script-src \'self\' \'unsafe-inline\'", \'X-Content-Type-Options\': \'nosniff\', \'Strict-Transport-Security\': \'max-age=31536000; includeSubDomains\')>\n>'),)) Bad logger message: Unexpected error creating device ((ResponseError('(get_acc_client_id: Expected status code 200, received: 401: <bound method ClientResponse.text of <ClientResponse(https://accsmart.panasonic.com/auth/v2/login) [401 Unauthorized]>\n<CIMultiDictProxy(\'Server\': \'CloudFront\', \'Date\': \'Fri, 05 Jul 2024 10:19:02 GMT\', \'Content-Length\': \'67\', \'Connection\': \'keep-alive\', \'Content-Type\': \'application/json\', \'X-Cache\': \'Error from cloudfront\', \'Via\': \'1.1 87bac7324deaa405623c690127b8a87c.cloudfront.net (CloudFront)\', \'X-Amz-Cf-Pop\': \'LIS50-P1\', \'Alt-Svc\': \'h3=":443"; ma=86400\', \'X-Amz-Cf-Id\': \'TW9uslPzFlYzP9L0U2EFZVLDd7zOE_GeCrrZvY_ctf4yu2G0bQaR7w==\', \'X-XSS-Protection\': \'1; report=1;mode=block\', \'X-Frame-Options\': \'DENY\', \'Content-Security-Policy\': "script-src \'self\' \'unsafe-inline\'", \'X-Content-Type-Options\': \'nosniff\', \'Strict-Transport-Security\': \'max-age=31536000; includeSubDomains\')>\n>'),))

sockless-coding commented 2 days ago

@antunespa you have to click load full logs to see all the debug messages They should look like DEBUG (MainThread) [custom_components.panasonic_cc.pcomfortcloud.panasonicsession] Starting Session

antunespa commented 2 days ago

@antunespa you have to click load full logs to see all the debug messages They should look like DEBUG (MainThread) [custom_components.panasonic_cc.pcomfortcloud.panasonicsession] Starting Session

Sorry for my ignorance but in full log dont show info about the login.

1 1 1 2

antunespa commented 1 day ago

Every time that i try to add the integration, insert my credencials i dont have debug message in full log, only in first view logs.

sockless-coding commented 8 hours ago

@antunespa, and the credentials work in the app? And MFA is configured pref with SMS option. It seems to authenticate all the way until getting the client id and then returning Unauthorized