sockless-coding / panasonic_cc

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

unknow error after update latest version 1.0.37 #122

Open andrealonghi opened 10 months ago

andrealonghi commented 10 months ago

after updating for the "hacs comfort cloud unexpected error occurred creatina device" to latest version 1.0.37 integration does not work anymore. after login, unknown error occurs. login and password work ok with confort cloud app and new amazon skill. tks!

TomF79 commented 10 months ago

Try to reinstall the integration, this should work.

andrealonghi commented 10 months ago

Tried thi procedure but unsuccesfully: disabled Cc integration removed Cc integration rebooted ha verified from fs side if everything ok reinstalled integration

any suggestion is welcome! thx!

sockless-coding commented 10 months ago

Hmm, hard to troubleshot without any logs... Activate debug logging for the integration and post the logs here... I don't remember if it includes username and password, so make sure you remove any sensitive data before posting.

qbnr7 commented 10 months ago

Will this help?

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/panasonic_cc/pcomfortcloud/session.py:426
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:15:49 AM (2 occurrences)
Last logged: 10:15:58 AM

[139857528338752] Invalid response, status code: 403 - Data: {"code":4300,"message":"Have no authority to the request"}
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 353, in set_device
    self._api.set_device(
  File "/config/custom_components/panasonic_cc/pcomfortcloud/session.py", line 426, in set_device
    raise ResponseError(response.status_code, response.text)
custom_components.panasonic_cc.pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data: {"code":4300,"message":"Have no authority to the request"}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 227, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/panasonic_cc/climate.py", line 129, in async_set_hvac_mode
    await self._api.set_hvac_mode(hvac_mode)
  File "/config/custom_components/panasonic_cc/panasonic.py", line 294, in set_hvac_mode
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/panasonic_cc/panasonic.py", line 24, in wrapper_call
    func(*args, **kwargs)
  File "/config/custom_components/panasonic_cc/panasonic.py", line 353, in set_device
    self._api.set_device(
  File "/config/custom_components/panasonic_cc/pcomfortcloud/session.py", line 426, in set_device
    raise ResponseError(response.status_code, response.text)
custom_components.panasonic_cc.pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data: {"code":4300,"message":"Have no authority to the request"}
qbnr7 commented 10 months ago

I also get this one:

Logger: homeassistant.components.sensor
Source: custom_components/panasonic_cc/sensor.py:142
Integration: Sensor (documentation, issues)
First occurred: 10:30:38 AM (2 occurrences)
Last logged: 10:30:38 AM

Error adding entities for domain sensor with platform panasonic_cc
Error while setting up panasonic_cc platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1002, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/panasonic_cc/sensor.py", line 142, in state
    return round(self._api.daily_energy,2)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type NoneType doesn't define __round__ method
sockless-coding commented 10 months ago

@qbnr7 The error indicates that the user you have authenticated with doesn't have modify rights on your HVAC. If you log in to Comfort Cloud with this user, can you change any settings?

qbnr7 commented 10 months ago

@qbnr7 The error indicates that the user you have authenticated with doesn't have modify rights on your HVAC. If you log in to Comfort Cloud with this user, can you change any settings?

I can log into the app, but my heat pump is connected through AQUAREA (but with the same credentials). And that is where I can control it.

willysagefalk commented 10 months ago

Same problem here. Stopped working after upgrade....

Logginformation (FEL) Felet härrör från en anpassad integration. Logger: homeassistant.config_entries Source: custom_components/panasonic_cc/pcomfortcloud/session.py:158 Integration: Panasonic Comfort Cloud (documentation) First occurred: 11:49:45 (5 occurrences) Last logged: 13:33:36

Error setting up entry for panasonic_cc Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, 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.11/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 201, in get_devices self.login() File "/config/custom_components/panasonic_cc/pcomfortcloud/session.py", line 105, in login self._create_token() File "/config/custom_components/panasonic_cc/pcomfortcloud/session.py", line 158, in _create_token raise ResponseError(response.status_code, response.text) custom_components.panasonic_cc.pcomfortcloud.session.ResponseError: Invalid response, status code: 400 - Data: {"code":"4000","message":"Missing required header parameter or bad request for header"}

sockless-coding commented 10 months ago

@willysagefalk You are not running v1.0.37, the error you are getting is the missing headers Panasonic added as a new requirement.

sockless-coding commented 10 months ago

@qbnr7 Ok, so the issue is probably because Home Assistant is trying to set the hvac mode through the Panasonic Comfort cloud, and they added a 403 Have no authority to the request response in the latest update. Could you pull the information before? And were you able to change any values from HA?

qbnr7 commented 10 months ago

I am not sure it worked before either, but I was looking into and saw I was on a very old version.

I can load the plugin and login the Panasonic cloud. But I have not control over the heat pump.

image

I am also control it through the AQUAREA integration. But I was hoping to use your integration as it has more entities.