jamiewalters / python-verisure-climate

7 stars 3 forks source link

Basic authentication does not work anymore #14

Open JonasJes opened 1 year ago

JonasJes commented 1 year ago

I just installed this to my HA, and really hoped it would add the heatpump for my automations Unfortunately, the authentication method does not look like it is working anymore

ERROR (MainThread) [homeassistant.components.climate] Error while setting up verisureclimate platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
    await asyncio.shield(task)
  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/verisureclimate/climate.py", line 92, in setup_platform
    session.login()
  File "/config/custom_components/verisureclimate/verisure/session.py", line 93, in login
    self._create_cookie()
  File "/config/custom_components/verisureclimate/verisure/session.py", line 123, in _create_cookie
    raise ResponseError(response.status_code, response.text)
custom_components.verisureclimate.verisure.session.ResponseError: Invalid response, status code: 401 - Data: {"errorGroup":"UNAUTHORIZED","errorCode":"AUT_00048","errorMessage":"Not allowed to use basic authentication with a CPE user on this resource"}
bullas82 commented 1 year ago

It works still in version 2023.2.4. Tried upgrading today to the latest version of HA and it broke. Had to revert to 2023.2.4 again.

JonasJes commented 1 year ago

Mine is running 2023.1.7 I would suspect it is a change in the Verisure API, and your working authentication could be because it is cached.

I have looked into the code this is built around, it has also changed the authentication method, but also refactored the whole code https://github.com/persandstrom/python-verisure/blob/version-2/verisure/session.py So I guess that could be implemented into this, but that would take someone with python experience and probably a lot of time to refactor into the current state.

I found one of the Contributors in the HA forum, and he has swapped his unit to use ESPHome instead https://community.home-assistant.io/t/verisure-include-panasonic-heatpumps/70067/8 But the ESPHome also looks like it is obsolete