sockless-coding / panasonic_cc

Panasonic Comfort Cloud - Home Assistant Component
MIT License
137 stars 35 forks source link

Unecpected error occured #82

Closed Segran closed 1 month ago

Segran commented 2 years ago

When re-installing the latest Panasonic Cloud (using HACS) i get an error message after entering the id and password saying ”Unexpected error occured”.

The id and password works fine when logging in to the Panasonic Cloud web site as well as for the Panasonic Cloud app.

sockless-coding commented 2 years ago

If you check the Home Assistant log, what is the error message reported by integration? Btw, you are not trying to connect an Aquarea device?

Segran commented 2 years ago

Here are the screen dumps from the log:

20 juli 2022 kl. 09:22 skrev Jimmy Everling @.***>:

If you check the Home Assistant log, what is the error message reported by integration? Btw, you are not trying to connect an Aquarea device?

— Reply to this email directly, view it on GitHub https://github.com/sockless-coding/panasonic_cc/issues/82#issuecomment-1189921708, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK4YWNKX364YTIE6RFKLC3VU6SLNANCNFSM54BV4KHA. You are receiving this because you authored the thread.

sockless-coding commented 2 years ago

@Segran think you forgot the actual logs :) Or at least I can't see them...

Segran commented 2 years ago

You're quite right, don't know where they disappeared to. Here's a new attempt: Logger: aiohttp.server Source: custom_components/panasonic_cc/pcomfortcloud/settings.py:4 Integration: Panasonic Comfort Cloud (documentation) First occurred: 23:18:00 (1 occurrences) Last logged: 23:18:00

Error handling request Traceback (most recent call last): File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/ban.py", line 79, in ban_middleware return await handler(request) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/auth.py", line 219, in auth_middleware return await handler(request) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/view.py", line 137, in handle result = await result File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/config/config_entries.py", line 166, in post return await super().post(request, flow_id) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/data_validator.py", line 62, in wrapper result = await method(view, request, *args, **kwargs) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/helpers/data_entry_flow.py", line 111, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 252, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 325, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/Users/MiniMac/.homeassistant/custom_components/panasonic_cc/config_flow.py", line 83, in async_step_user return await self._create_device(user_input[CONF_USERNAME], user_input[CONF_PASSWORD]) File "/Users/MiniMac/.homeassistant/custom_components/panasonic_cc/config_flow.py", line 56, in _create_device from . import pcomfortcloud File "/Users/MiniMac/.homeassistant/custom_components/panasonic_cc/pcomfortcloud/init.py", line 12, in from .session import ( File "/Users/MiniMac/.homeassistant/custom_components/panasonic_cc/pcomfortcloud/session.py", line 14, in from .settings import PanasonicSettings File "/Users/MiniMac/.homeassistant/custom_components/panasonic_cc/pcomfortcloud/settings.py", line 4, in from packaging import version ModuleNotFoundError: No module named 'packaging'

sockless-coding commented 2 years ago

Hmm, interesting, you don't seem to have the packaging package. What version of HA do you have?

Segran commented 2 years ago

Tried upgrading HA to 2022.8 - didn't make any difference.

Segran commented 2 years ago

After restoring backup to state as of July 15 (still HA 2022.4.2) I am back at the original problem, the Panasonic Cloud integration says "Det gick inte att ställa in".

The error message is: Logger: homeassistant.config_entries Source: deps/lib/python3.9/site-packages/pcomfortcloud/session.py:96 First occurred: 22:05:58 (1 occurrences) Last logged: 22:05:58

So my question no is what to do? removing and re-installing the Panasonic Cloud integration is obviously not working.

The complete log: Error setting up entry for panasonic_cc Traceback (most recent call last): File "/Users/MiniMac/.homeassistant/deps/lib/python3.9/site-packages/pcomfortcloud/session.py", line 89, in login self._get_groups() File "/Users/MiniMac/.homeassistant/deps/lib/python3.9/site-packages/pcomfortcloud/session.py", line 154, in _get_groups raise ResponseError(response.status_code, response.text) pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data:

403 Forbidden

403 Forbidden

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/config_entries.py", line 335, in async_setup result = await component.async_setup_entry(hass, self) File "/Users/MiniMac/.homeassistant/custom_components/panasonic_cc/init.py", line 79, in async_setup_entry devices = await hass.async_add_executor_job(api.get_devices) File "/Users/MiniMac/.pyenv/versions/3.9.8/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/Users/MiniMac

Thanks for your assistance.

vooteleaer commented 2 years ago

Same here Latest home assistant core

Error handling request Traceback (most recent call last): File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/ban.py", line 82, in ban_middleware return await handler(request) File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/view.py", line 136, in handle result = await result File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/config/config_entries.py", line 177, in post return await super().post(request, flow_id) File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/data_validator.py", line 73, in wrapper result = await method(view, request, data, *args, **kwargs) File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/data_entry_flow.py", line 109, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 277, in async_configure result = await self._async_handle_step( File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 359, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/config_flow.py", line 83, in async_step_user return await self._create_device(user_input[CONF_USERNAME], user_input[CONF_PASSWORD]) File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/config_flow.py", line 56, in _create_device from . import pcomfortcloud File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/pcomfortcloud/init.py", line 12, in from .session import ( File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/pcomfortcloud/session.py", line 14, in from .settings import PanasonicSettings File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/pcomfortcloud/settings.py", line 4, in from packaging import version ModuleNotFoundError: No module named 'packaging'

vooteleaer commented 2 years ago

BTW I installed packaging to be sure - pip3 install packaging

hapcbru commented 1 year ago

Any solution?

turbokongen commented 1 year ago

Hello! I have the same issue:

Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/config/config_entries.py", line 181, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/data_entry_flow.py", line 296, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/data_entry_flow.py", line 392, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/config_flow.py", line 83, in async_step_user
    return await self._create_device(user_input[CONF_USERNAME], user_input[CONF_PASSWORD])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/config_flow.py", line 56, in _create_device
    from . import pcomfortcloud
  File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/pcomfortcloud/__init__.py", line 12, in <module>
    from .session import (
  File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/pcomfortcloud/session.py", line 14, in <module>
    from .settings import PanasonicSettings
  File "/home/homeassistant/.homeassistant/custom_components/panasonic_cc/pcomfortcloud/settings.py", line 4, in <module>
    from packaging import version
ModuleNotFoundError: No module named 'packaging'

The solution is to include this package in the requirements of panasonic_cc module.

Manually solving this with:

# Enter into virtualenv user of homeassistant
sudo -u homeassistant -H -s
# Enter homeassistant source directory
cd /srv/homeassistant
# Activate the virtual environment
source ./bin/activate
# Install the pip package for packaging module
pip install packaging
# Deactivate the virtual environment
deactivate
# Exit the homeassistant user
exit

The key point here is to install the package inside the homeassistant user and not system wide.

Then try to set up in homeassisant again. Works like a charm 😎