Giter Club home page Giter Club logo

python-thermia-online-api's Introduction

> Hey!👋🏻 I am Krisjanis!

Website

Masters student @University_of_Latvia, developer @Accenture

  • 🔭 I’m currently working on frontend and some backend
  • 🌱 I’m currently learning IT management
  • ⚡ Fun fact: My interests include managing Smart Home and self hosting stuff

Find me here:

krisjanis.lejejs.com krisjanis.lejejs | LinkedIn krisjanis2000 | Facebook krisjanis2000 | Twitter krisjanis2000 | Instagram


python-thermia-online-api's People

Contributors

klejejs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-thermia-online-api's Issues

Again problem setting parameters

For some time it worked.
But now problem appears again
Every time while programm tries to set parameter it gives error
For example:
heat_pump.set_temperature(19)
it gives: Error setting register 6010 value. 400

heat_pump.set_operation_mode("COMPRESSOR")
Error setting register 51 value. 400

My pump is Thermia Diplomat

ITec missing operational status

Example how its shown on thermia online (classic), unfortunately I couldn't change the UI language.

image

Running example.py / debug lists:

Operational status
Operational status: None
Available operational statuses: None
Available operational statuses map: None
Auxiliary heater 3KW: None
Auxiliary heater 6KW: None
Auxiliary heater 9KW: None
Auxiliary heater 12KW: None
Auxiliary heater 15KW: None
Compressor status: None
Brine pump status: None
Radiator pump status: None
Cooling status: None
Hot water status: None
Heating status: None
Integral: None

I think the related entry in debug.txt is:

Group REG_GROUP_OPERATIONAL_STATUS:
[
    {
        "canBeShownInGraph": false,
        "canBeShownInHistory": true,
        "collapsible": false,
        "disabledByLink": false,
        "falseText": null,
        "graphRegisterIndex": 10031,
        "groupId": 4,
        "groupItemId": 386,
        "groupItemOrder": 70001,
        "groupName": "REG_GROUP_OPERATIONAL_STATUS",
        "groupOrder": 60010,
        "groupParentId": null,
        "isComputedRegister": false,
        "isInvisible": false,
        "isReadOnly": true,
        "maxValue": null,
        "minValue": null,
        "modifier": 4,
        "precision": null,
        "presentation": "Integer",
        "registerId": 10031,
        "registerIndex": 2120,
        "registerName": "REG_PID",
        "registerValue": -23,
        "step": 1,
        "stringRegisterValue": null,
        "timeStamp": "2022-12-30T13:28:59.303Z",
        "trueText": null,
        "unit": "NotSpecified",
        "valueNames": null
    },
    {
        "canBeShownInGraph": false,
        "canBeShownInHistory": false,
        "collapsible": false,
        "disabledByLink": false,
        "falseText": null,
        "graphRegisterIndex": 10002,
        "groupId": 4,
        "groupItemId": 400,
        "groupItemOrder": 70020,
        "groupName": "REG_GROUP_OPERATIONAL_STATUS",
        "groupOrder": 60010,
        "groupParentId": null,
        "isComputedRegister": true,
        "isInvisible": false,
        "isReadOnly": true,
        "maxValue": null,
        "minValue": null,
        "modifier": 0,
        "precision": null,
        "presentation": "StatusFlagsTextInd",
        "registerId": 10002,
        "registerIndex": 10002,
        "registerName": "COMP_STATUS_ITEC",
        "registerValue": 19,
        "step": 1,
        "stringRegisterValue": null,
        "timeStamp": "2022-12-30T14:39:30.9215449Z",
        "trueText": null,
        "unit": "0",
        "valueNames": [
            {
                "confirmation": null,
                "isReadonly": false,
                "name": "COMP_VALUE_COMPR",
                "value": 1,
                "visible": true
            },
            {
                "confirmation": null,
                "isReadonly": false,
                "name": "COMP_VALUE_RADIATORPUMP",
                "value": 2,
                "visible": false
            },
            {
                "confirmation": null,
                "isReadonly": false,
                "name": "COMP_VALUE_HOT_WATER",
                "value": 8,
                "visible": true
            },
            {
                "confirmation": null,
                "isReadonly": false,
                "name": "COMP_VALUE_HEATING",
                "value": 16,
                "visible": true
            },
            {
                "confirmation": null,
                "isReadonly": false,
                "name": "COMP_VALUE_DEFROST",
                "value": 32,
                "visible": true
            },
            {
                "confirmation": null,
                "isReadonly": false,
                "name": "COMP_VALUE_POOL",
                "value": 64,
                "visible": false
            },
            {
                "confirmation": null,
                "isReadonly": false,
                "name": "COMP_VALUE_COOLING",
                "value": 128,
                "visible": true
            }
        ]
    }
]`

New Issue from appears 30.04.2024

Launching example.py it give the error:
Traceback (most recent call last):
File "C:\Users\ganet\PycharmProjects\pythonProject\Thermia\Sql\example.py", line 18, in
thermia = Thermia(USERNAME, PASSWORD, api_type=API_TYPE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ganet\Pycharm\Lib\site-packages\ThermiaOnlineAPI_init_.py", line 14, in init
self.api_interface = ThermiaAPI(username, password, api_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ganet\Pycharm\Lib\site-packages\ThermiaOnlineAPI\api\ThermiaAPI.py", line 78, in init
self.authenticated = self.__authenticate()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ganet\Pycharm\Lib\site-packages\ThermiaOnlineAPI\api\ThermiaAPI.py", line 590, in _authenticate
settings = json.loads(settings_string[0][15:-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\json_init
.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Process finished with exit code 1

Hot water temp reading

Is it possible to read hot water temperature as well in addition to all other metrics?

Genesis to Online/classic Update (Genesis broken)

Hi,

So had issue after Thermia "updated to v2" for my genesis access. It seems like that genesis has been moved to online/classic (or both being updated, dont know).

I was thrown the following error, but after changing to classic it works correct with my pump as well.
Didnt know whether or not to post this as an issue, but now its here as info at least. Please close accordingly.
Maybe genesis should be removed entirely if this is the case for everyone?

Regards,
Gjorret


Exception has occurred: JSONDecodeError
Expecting value: line 1 column 1 (char 0)
StopIteration: 0

During handling of the above exception, another exception occurred:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

  File "C:\Scripts\Thermia\ThermiaOnlineAPI\api\ThermiaAPI.py", line 513, in __fetch_configuration
    return request.json()
           ^^^^^^^^^^^^^^
  File "C:\Scripts\Thermia\ThermiaOnlineAPI\api\ThermiaAPI.py", line 77, in __init__
    self.configuration = self.__fetch_configuration()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Scripts\Thermia\ThermiaOnlineAPI\__init__.py", line 14, in __init__
    self.api_interface = ThermiaAPI(username, password, api_type)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Scripts\Thermia\example.py", line 27, in <module>
    thermia = Thermia(USERNAME, PASSWORD, api_type=API_TYPE)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Heatpump in offline state give error on every poll

I have two heatpumps in my Thermia genesis account where one of them are a ghost that i can not remove. The ghost heatpump is in offline state with 'isOnline': False. My issue is that the entities of my actual heatpump are not updated except from the initial reading and in addition i get a error message in the CORE system log in HA for each poll cycle.

2022-02-10 18:47:51 ERROR (MainThread) [ThermiaOnlineAPI.model.HeatPump] Error in getting device's temperature status. No temperature register index.

A sugested improvment is that the integration are able to handle heatpumps that are offline.

problem running version 3.4

After downloading, the latest version (3.4) the api stopped working for my code. Running the example gives the same error:

Traceback (most recent call last):
File "example.py", line 2, in
from ThermiaOnlineAPI import Thermia
File "/home/pi/python-thermia-online-api-main-4/ThermiaOnlineAPI/init.py", line 3, in
from ThermiaOnlineAPI.api.ThermiaAPI import ThermiaAPI
File "/home/pi/python-thermia-online-api-main-4/ThermiaOnlineAPI/api/ThermiaAPI.py", line 28, in
from ..model.HeatPump import ThermiaHeatPump
File "/home/pi/python-thermia-online-api-main-4/ThermiaOnlineAPI/model/HeatPump.py", line 41, in
"hot_water_boost_switch": None,
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Can not set parameters

When example.py runs using CHANGE_HEAT_PUMP_DATA_DURING_TEST =True it gaves:
Error setting register 6010 value. 400
Error setting register 52 value. 400
Error setting register 51 value. 400

Genesis support

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.

API chaged by Thermia

Not sure if it affects the code used here (but I used a hacked version of this running behind a google sheet)

they chaged 2 things this week

they added a "2" to the front of my installaiton ID
they reverted the registerID and registerIndex to the way it used to work - this has the effect you have to put "10" in front of some registers

as I say - not sure if its a problem with this code but the API has definatly changed
I WISH THEY WOULD EMAIL USERS TO SAY THEY ARE MAKING THESE CHANGES

Problem with hotwater switch

Hi, first of all thanks for a great API. unfortunately the hotwater switch stopped working with the latest update giving me "Error setting register 1059 value. 400". I have included my Debug test if you have a chance to take a look.
All the best
/J
debug.txt

support for DHP-H Opti Pro+ models

I have a Danfoss DHP-H Opti Pro+ 10 heatpump (profile Diplomat / Diplomat duo); obviously not supported by the thermal-online-api. However I gave it a try, and many things work well:

  • all data that was returned seems to be correct
  • set_temperature works correctly
  • set_operation_mode works correctly

However, it does not provide the current Operational Status. The test program (Danfoss.py) gives:

Operational status
Operational status: None
Available operational statuses: []
Available operational statuses map: {}

It would be great if the api would provide the operational status information. The information is available as the Thermia website shows:

Compressor Running
Brinepump Running
Active cooling -
Hot water -
Heating Running
Integral -29

I realise that I run the api in an unsupported environment so I was really pleased to see well this worked in its current state. It seems only a small step to get the api fully operational on the DHP-H models and I can definitely help in testing the api on my heatpump.

Differences in Register Names

Hi! I have a Thermia Calibra 12 [230] that mostly works with this API and Home Assistant Integration. I've found that the properties on HeatPump like operational_status_hot_water_status and operational_status_heating_status don't work properly for my heat pump because the strings are different. For example, the API code references HOT_WATER but in my map of operational statuses it only lists STATUS_HOTWATER. It would make sense to have some kind of lookup map that could store these differences but I'm not sure what value could be used to determine the map to use. I'm happy to provide a PR if this makes sense.

I'm including the contents of my debug.txt as that might give you more clues.
debug.txt

Operation mode for control of heating

Hi Krisjanis,
Thank you for a really great library. I intend to use your library to force the heating to the hours with the cheapest electricity. With your knowledge, which operation mode do you recommend to enable/disable the heating? I have a Thermia Calibra Eco.
Best Regards,
Goran

Issue with example.py

Hi,
installed the requirements using pip3 and want to test the example.py.

Script asks for credentials and says connected is true but then can't find a heat pump. I'm having a Thermia Calibra.

Do you have any idea?

[/share/Container/iobroker-data/scripts/thermia] # python3 example.py
Enter username: xxxx
Enter password: xxxx
Connected: True
Traceback (most recent call last):
File "/share/CACHEDEV1_DATA/Container/iobroker-data/scripts/thermia/example.py", line 17, in
heat_pump = thermia.fetch_heat_pumps()[0]
IndexError: list index out of range

Authentification error

Launching example.py I have got issue
Traceback (most recent call last):
File "C:\Users\ganet\PycharmProjects\pythonProject\Thermia\Sql\example.py", line 13, in
thermia = Thermia(USERNAME, PASSWORD)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ganet\Pycharm\Lib\site-packages\ThermiaOnlineAPI_init_.py", line 13, in init
self.api_interface = ThermiaAPI(username, password)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ganet\Pycharm\Lib\site-packages\ThermiaOnlineAPI\api\ThermiaAPI.py", line 73, in init
self.authenticated = self.__authenticate()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ganet\Pycharm\Lib\site-packages\ThermiaOnlineAPI\api\ThermiaAPI.py", line 680, in __authenticate
"code": request_confirmed.url.split("code=")[1],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Process finished with exit code 1

State ”Unknown”

State says ”Unknown” – should be “No demand” or others.

Operations I can switch in Thermia Online desktop (or app).
Temperature
Hotwater (on/off)
Boost (on/off)
Room Senor (On/Off)

Operational Status in thermia online:
Manual
Hot water
Heating
Active cooling
Pool
Anti Legionella
Passive cooling
StandBy
No Demand
Off

Debug file:
debug.txt

image
image
image
image

Genesis went down?

I know its not an issue with the script, but anyone can confirm they also having issue getting data out?

Last time i was able to fetch was 4am UTC+2.

Seems like its actually able to get temperatures but getting 404 on fetching devices (maybe a bit random if it succeeds or not)

online-genesis is blank, so i guess there is an issue (i was wondering if i got blocked or so, but also happens from work).

Anyways, have you seen that its possible to get COP on the device now with new firmware. Do you know if its possible to get that out from the API? (Currently online viewable on the device).

Thanks for a great piece of software!

Regards,
Rasmus

Error setting register

HI!

Thanks for a great job!

I have been using your api for more then 1 year and so far hade no problem, and if any, i just updated to the latest, and it just worked.

But this time i start to have a problem yesterday and then i updated to the latest version, but i sill have the same problem.
I get this error message where ## is the register number i try to set.

"Error setting register ## value. 400"

The Thermia app still works good. I tried to create a new account and tried an other computer and on an other site. Still the same problem. Any suggestions?

Operational status Diplomat

Hi, I Believe I have a similar issue as this one; #14

I have a Thermia Diplomat. The statuses do not show properly. In the Thermia Online can see the operational statuses.
image

But this is the output from the example.py:

Operational status Operational status: None Available operational statuses: None Available operational statuses map: None Auxiliary heater 3KW: 1 Auxiliary heater 6KW: 2 Auxiliary heater 9KW: None Auxiliary heater 12KW: None Auxiliary heater 15KW: None Compressor status: 1 Brine pump status: 2 Radiator pump status: None Cooling status: 8 Hot water status: 16 Heating status: 32 Integral: -150 Pid: None

I have done a few runs with different statuses being active. The debug files are the same each time. The only relevant difference I find is

  • Nothing Running: COMP_STATUS Value 4
  • Brinepump and Hot water Running: COMP_STATUS Value 22
  • Compressor and Brinepump and Heating Running COMP_STATUS Value 39

debug compressor brinepump and heating active.txt
debugnothing active.txt
debug brinepump and hotwater running.txt

Failure setting hot water switch state

Hello and thanks for this very nice package :)

I am able to use most of the functionality with my Calibra Duo HP through the genesis interface, except for

heat_pump.set_hot_water_switch_state

which appears to always return

>>> heat_pump.set_hot_water_switch_state(1)
Error setting register 1059 value. 400

Getting the switch state works fine

>>> heat_pump.hot_water_switch_state
0

Is there perhaps an error in the register value map or something, or what could I be doing wrong?

FWIW:

>>> heat_pump.is_hot_water_switch_available
True

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.