hemphen / hass-clevertouch

CleverTouch - Home Assistant integration for Touch E3 radiators
MIT License
5 stars 0 forks source link

Wrong parameters #7

Open hasselrot opened 1 year ago

hasselrot commented 1 year ago

Since yesterday my integration is no longer working. Home assistant is giving this log.

  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/clevertouch/coordinator.py", line 79, in _async_update_data
    self.user = await self.api_session.get_user()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/clevertouch/objects.py", line 58, in get_user
    await user.refresh()
  File "/config/deps/lib/python3.11/site-packages/clevertouch/objects.py", line 121, in refresh
    data = await self._api_session.read_user_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/clevertouch/api.py", line 148, in read_user_data
    result = await self._read(endpoint, payload)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/clevertouch/api.py", line 125, in _read
    raise ApiCallError(result.status, f"Read failed with {result.status}")
clevertouch.api.ApiCallError: Read failed with ERR_PARAM(3): Wrong parameters
2023-10-28 05:11:59.467 ERROR (MainThread) [homeassistant] Error doing job: Unclosed client session
2023-10-28 05:11:59.467 ERROR (MainThread) [homeassistant] Error doing job: Unclosed connector
2023-10-28 05:12:16.129 ERROR (MainThread) [homeassistant] Error doing job: Unclosed client session
2023-10-28 05:12:38.304 ERROR (MainThread) [custom_components.clevertouch.coordinator] Unexpected error fetching clevertouch-purmo-lars@hasselrot.net data: Read failed with ERR_PARAM(3): Wrong parameters
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/clevertouch/coordinator.py", line 79, in _async_update_data
    self.user = await self.api_session.get_user()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/clevertouch/objects.py", line 58, in get_user
    await user.refresh()
  File "/config/deps/lib/python3.11/site-packages/clevertouch/objects.py", line 121, in refresh
    data = await self._api_session.read_user_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/clevertouch/api.py", line 148, in read_user_data
    result = await self._read(endpoint, payload)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/clevertouch/api.py", line 125, in _read
    raise ApiCallError(result.status, f"Read failed with {result.status}")
clevertouch.api.ApiCallError: Read failed with ERR_PARAM(3): Wrong parameters

Can the API have been changed on e3 side?

hemphen commented 1 year ago

It's possible. Still works on my side though. Both reading and writing.

I restarted HomeAssistant to make sure it wasn't an initialization issue only.

I believe I am on an old version of HomeAssistant but that is likely irrelevant given the error message.

I did not attempt to remove the service and add it again.

Maybe you should at least try the restart.

(I of course assume that your installation works in the CleverTouch app.)

hasselrot commented 1 year ago

If it works for you, it is unlikely they introduced a breaking change on their side. And the app works.

But I am on a rather new version of HA. Maybe the latest: 2023.11.0b1

Sent from Gmail Mobile

On Sat, 28 Oct 2023 at 08:30, Michael Hemph @.***> wrote:

It's possible. Still works on my side though. Both reading and writing.

I restarted HomeAssistant to make sure it wasn't an initialization issue only.

I believe I am on an old version of HomeAssistant but that is likely irrelevant given the error message.

I did not attempt to remove the service and add it again.

Maybe you should at least try the restart.

(I of course assume that your installation works in the CleverTouch app.)

— Reply to this email directly, view it on GitHub https://github.com/hemphen/hass-clevertouch/issues/7#issuecomment-1783721374, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBC6PEXN2HHXH7OHOCKFU3YBSRBTAVCNFSM6AAAAAA6TWYIOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBTG4ZDCMZXGQ . You are receiving this because you authored the thread.Message ID: @.***>

hemphen commented 1 year ago

Fortunately Höstlov (school holiday) is coming up. I'll have time to upgrade and look into it.

There is another non-critical issue anyway that seems to have been introduced with newer versions HomeAssistant (#6).

hasselrot commented 1 year ago

Thats great! Let me know if I can help and when to test!

Sent from Gmail Mobile

On Sat, 28 Oct 2023 at 09:10, Michael Hemph @.***> wrote:

Fortunately Höstlov (school holiday) is coming up. I'll have time to upgrade and look into it.

There is another non-critical issue anyway that seems to have been introduced with newer versions HomeAssistant (#6 https://github.com/hemphen/hass-clevertouch/issues/6).

— Reply to this email directly, view it on GitHub https://github.com/hemphen/hass-clevertouch/issues/7#issuecomment-1783728923, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBC6PDFCCQUHZCZAAOGJF3YBSVWVAVCNFSM6AAAAAA6TWYIOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBTG4ZDQOJSGM . You are receiving this because you authored the thread.Message ID: @.***>

hemphen commented 1 year ago

Upgraded to latest stable (container) version 20231005.0 without issues. Integration still works, perhaps "unfortunately" since it makes debugging much harder.

So, two simpler tests remains:

1) For you to reconfigure your account - it could possibly be your session token that has expired. It has some absurd lifetime - two years or so - meaning that I never got around to implement a refresh for it. I am not sure exactly how the reconfiguration affects your customizations though. I guess they will go unaffected given that you're not changing any names or device ids etc. but I can't promise anything. I would recommend backing up your config.

2) For me to install the beta - but it seems like a long shot.

If none of those works I need to implement better logging and you perhaps increase verbosity on your side.

hasselrot commented 1 year ago

Alright, it seems more and more likely that it is something on my side.

I can absolutely try to reconfigure the account. But how do I get the integration to prompt for username/password again? Is the token stored in some file that I could replace? I can easily get it from the browser.

On Tue, Oct 31, 2023 at 11:49 AM Michael Hemph @.***> wrote:

Upgraded to latest stable (container) version 20231005.0 without issues. Integration still works, perhaps "unfortunately" since it makes debugging much harder.

So, two simpler tests remains:

1.

For you to reconfigure your account - it could possibly be your session token that has expired. It has some absurd lifetime - two years or so - meaning that I never got around to implement a refresh for it. I am not sure exactly how the reconfiguration affects your customizations though. I guess they will go unaffected given that you're not changing any names or device ids etc. but I can't promise anything. I would recommend backing up your config. 2.

For me to install the beta - but it seems like a long shot.

If none of those works I need to implement better logging and you perhaps increase verbosity on your side.

— Reply to this email directly, view it on GitHub https://github.com/hemphen/hass-clevertouch/issues/7#issuecomment-1786967714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBC6PCW3NLYQYDB6JRSCJDYCDJSVAVCNFSM6AAAAAA6TWYIOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBWHE3DONZRGQ . You are receiving this because you authored the thread.Message ID: @.***>

hasselrot commented 1 year ago

I got it!

The HA Gui was a bit buggy, but re-adding the integration from the integration settings page eventually worked.

Thanks for the help!

On Tue, Oct 31, 2023 at 8:28 PM Lars Hasselrot @.***> wrote:

Alright, it seems more and more likely that it is something on my side.

I can absolutely try to reconfigure the account. But how do I get the integration to prompt for username/password again? Is the token stored in some file that I could replace? I can easily get it from the browser.

On Tue, Oct 31, 2023 at 11:49 AM Michael Hemph @.***> wrote:

Upgraded to latest stable (container) version 20231005.0 without issues. Integration still works, perhaps "unfortunately" since it makes debugging much harder.

So, two simpler tests remains:

1.

For you to reconfigure your account - it could possibly be your session token that has expired. It has some absurd lifetime - two years or so - meaning that I never got around to implement a refresh for it. I am not sure exactly how the reconfiguration affects your customizations though. I guess they will go unaffected given that you're not changing any names or device ids etc. but I can't promise anything. I would recommend backing up your config. 2.

For me to install the beta - but it seems like a long shot.

If none of those works I need to implement better logging and you perhaps increase verbosity on your side.

— Reply to this email directly, view it on GitHub https://github.com/hemphen/hass-clevertouch/issues/7#issuecomment-1786967714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBC6PCW3NLYQYDB6JRSCJDYCDJSVAVCNFSM6AAAAAA6TWYIOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBWHE3DONZRGQ . You are receiving this because you authored the thread.Message ID: @.***>

hemphen commented 1 year ago

Great! I'll keep this issue open if someone else run into the same problem.

I also added a new issue #8 with the (supposedly) proper fix, which is supporting the reauthentication config flow.