Bouni / python-luxtronik

python-luxtronik is a library that allow you to interact with a Luxtronik heatpump controller.
MIT License
37 stars 20 forks source link

Support multiple object instances #85

Closed Guzz-T closed 1 year ago

Guzz-T commented 1 year ago

The current implementation uses class variables for the fields Parameters.parameters, Calculations.calculations and Visibilities.visibilities. Due to this, the memory for storing the read data is shared by all instances of the class Luxtronik.

Possible solution1:

Do not buffer the read data, but return them by calling read(). Just define the data structure within the Calculations.py (and so on).

Possible solution2:

Move the variable declaration into the __init__() section of the class Calculation (and so on).

Benefits:

If the instances are independent from each other, the interface could be used for multiple heat pumps in a multi-threaded application (like Homeassistant).

In terms of the OOP, solution 1 would fit better, since the data read does not belong to the luxtronik-read/write-interface

Bouni commented 1 year ago

Interested in submitting a PR? I have very limited time at the moment 😓

Guzz-T commented 1 year ago

I could give it a try.

Guzz-T commented 1 year ago

Got a first draft. Could you give me the rights to push a branch?

kbabioch commented 1 year ago

Got a first draft. Could you give me the rights to push a branch?

The typical workflow is to create a fork of the repository and prepare / work in your own repository. Once you think its good to go, you can create a pull request ;-).

Guzz-T commented 1 year ago

Opened a pull-request. See: https://github.com/Bouni/python-luxtronik/pull/86