panasonic_cc icon indicating copy to clipboard operation
panasonic_cc copied to clipboard

Error: New version app has been published

Open JonathanVarild opened this issue 2 years ago • 5 comments

Integration stopped working today and I was signed out of my Panasonic Comfort Cloud iOS app. After trying to add the device back onto Home Assistant after resetting my Panasonic Cloud password, I received the following error.

Unexpected error creating device Traceback (most recent call last): File "/config/custom_components/panasonic_cc/config_flow.py", line 60, in _create_device devices = await self.hass.async_add_executor_job(api.get_devices) File "/usr/local/lib/python3.10/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: 401 - Data: {"message":"New version app has been published","code":4106}

JonathanVarild avatar Apr 17 '23 18:04 JonathanVarild

I can confirm, it stopped working around 07:00 CEST for me. This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/panasonic_cc/pcomfortcloud/session.py:158 Integration: Panasonic Comfort Cloud (documentation) First occurred: 14:52:04 (5 occurrences) Last logged: 20:40:58

Error setting up entry for panasonic_cc
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, 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.10/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: 429 - Data: {"message":"Too Many Requests","code":42901}

Stockhauz avatar Apr 17 '23 18:04 Stockhauz

I'm currently trying to debug the code. It starts working fine when modifying the line of code below to self._appVersion = "1.18.0" which was an app version released 5 days ago. The previous value was 1.17.0 but I'm trying to understand where it's coming from so that I can fix the root cause of the version being set to 1.17.0 instead of 1.18.0.

https://github.com/sockless-coding/panasonic_cc/blob/375caaa34e7270a606d9cff173f2f59e2f429aa7/custom_components/panasonic_cc/pcomfortcloud/session.py#L64

JonathanVarild avatar Apr 17 '23 19:04 JonathanVarild

Addon is retrieving latest app version using function below by fetching App Store API. https://github.com/sockless-coding/panasonic_cc/blob/375caaa34e7270a606d9cff173f2f59e2f429aa7/custom_components/panasonic_cc/pcomfortcloud/session.py#L125

The locally stored version is fetched again after being 5 days or older and since version 1.17.0 was released on 13-04-2023, the locally stored version should be updated tomorrow and the addon should then start working again. https://github.com/sockless-coding/panasonic_cc/blob/375caaa34e7270a606d9cff173f2f59e2f429aa7/custom_components/panasonic_cc/pcomfortcloud/settings.py#L76

Alternatively, you can change the constant for the maximum allowed version age to a lower value like 3 by modifying the line of code below and restarting your Home Assistant. https://github.com/sockless-coding/panasonic_cc/blob/375caaa34e7270a606d9cff173f2f59e2f429aa7/custom_components/panasonic_cc/pcomfortcloud/constants.py#L65

Root cause basically seems to be that Panasonic have stopped accepting API requests for app version 1.17.0. App version 1.18.0 was released 4 days ago and the addon by default updates the local version 5 days after its release.

JonathanVarild avatar Apr 17 '23 19:04 JonathanVarild

I posted the method I used to fix this here: https://github.com/sockless-coding/panasonic_cc/issues/107#issuecomment-1513064868 Good spot on the max age. The app version is cached in the authentication token ($home/.panasonic-settings)

kenchy avatar Apr 18 '23 12:04 kenchy

This should be solved now.

codyc1515 avatar Jan 09 '24 20:01 codyc1515