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

Ensure datatype handling is stable when converting back and forth #114

Open kbabioch opened 1 year ago

kbabioch commented 1 year ago

Currently there seem to be some instabilities when converting data back and forth:

luxtronik.datatypes.Celsius.from_heatpump(luxtronik.datatypes.Celsius.to_heatpump(0.11))
0.1

This should be double-checked for all datatypes. Ideally there should be some automated unit tests for these cases. Also this should be fixed, potentially by using round() or similar approaches.

gerw commented 1 year ago

In my opinion, only to_heatpump(from_heatpump(...)) should be stable (for reasonable inputs). If we know, what "reasonable" inputs are (by adding, e.g., something like max, min and step variables to the datatype classes, see also #35), such a unit test could be implemented easily.