klejejs / python-thermia-online-api

A Python API for Thermia heat pumps using https://online.thermia.se
GNU General Public License v3.0
29 stars 10 forks source link

Genesis support #9

Closed patrikrask closed 2 years ago

patrikrask commented 2 years ago

Thank you for doing a Thermia API! "Genesis" authentication do not work for me. username and password work at "https://www.online-genesis.thermia.se/"


>>> from datetime import datetime, timedelta
>>> from ThermiaOnlineAPI import Thermia
>>> USERNAME = ".........."
>>> PASSWORD = "..........."
>>> thermia = Thermia(USERNAME, PASSWORD, "genesis")
Authentication request failed, please check credentials. 401
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/patrik/.local/lib/python3.10/site-packages/ThermiaOnlineAPI/__init__.py", line 13, in __init__
    self.api_interface = ThermiaAPI(username, password, api_type)
  File "/home/patrik/.local/lib/python3.10/site-packages/ThermiaOnlineAPI/api/ThermiaAPI.py", line 43, in __init__
    self.authenticated = self.__authenticate()
  File "/home/patrik/.local/lib/python3.10/site-packages/ThermiaOnlineAPI/api/ThermiaAPI.py", line 452, in __authenticate
    raise AuthenticationException(
ThermiaOnlineAPI.exceptions.AuthenticationException.AuthenticationException: Authentication request failed, please check credentials.
klejejs commented 2 years ago

Hello! Thermia recently started using a new login flow and for some that has unfortunately broken the API login. I will be looking into fixing it ASAP.

patrikrask commented 2 years ago

Hi Any progress :) I also wonder if you have any thoughts about using your python API? Have there, historically, been many updates needed? What your thoughts about the future? Regards Patrik

klejejs commented 2 years ago

@patrikrask Unfortunately no updates yet as the new login system is hard to integrate in the API. What do you mean by using the API? I personally use it for the Home Assistant integration and update it when necessary. Unfortunately, it does not happen that often though as I am quite busy with other things as well 🥲.

kaarikim commented 2 years ago

I will look into this as I need the change for myself also. Do not promise anything though. Got it working with generated token, now just need to dig more deeply into how token is generated and what attributes are needed while doing so.

kaarikim commented 2 years ago

Got the POC working. Now need to tidy the code and make some minor changes.

johanhessler commented 2 years ago

great @kaarikim ! Looking forward to it

kaarikim commented 2 years ago

@klejejs Pull request created. :-)

klejejs commented 2 years ago

@kaarikim Thanks very much for your work on this!

klejejs commented 2 years ago

The latest release should fix the issue thanks to @kaarikim. Please open the PR again if any of you still encounter any issues with logging in.