Closed wilriker closed 1 year ago
Sorry for ignoring this for so long. Let's get going here.
Changes to me look fine to me.
What I would like to see, though, are unit tests to make sure that this will not be forgotten for any new datatypes, etc.
@wilriker Would you be willing to work on this, or should I give it a go?
@Bouni Any feedback regarding this PR?
Hi @kbabioch!
I just pushed a set of test cases checking for None
. Is that sufficient?
LGTM
Thank your for the test cases. Changes itself look fine, but I'm still trying to understand the root cause of the issue here. So in your case you were trying to access parameters that you're firmware doesn't know about.
What is returned as raw value in this case? None
is a Python-specific value, but what is actually being returned by the Luxtronik controller?
Just a speculation: In
https://github.com/Bouni/python-luxtronik/blob/16a5f6f91891a7ade1824e51f241c797aff21cef/luxtronik/datatypes.py#L16
the .raw
is set to None
. If the heat pump only returns 500 parameters (indicated by length
), then the raw
values of all the other parameters is still None
.
the
.raw
is set toNone
. If the heat pump only returns 500 parameters (indicated bylength
), then theraw
values of all the other parameters is stillNone
.
That might be a good explanation. Is this something we should handle in the code, or if this is expected behaviour? Where have you seen / derived the 500
from?
Since I have upgraded my heatpump firmware meanwhile I can no longer reproduce the initial problem. At that time I was running a 1.69 version (that still had the old Java Applet).
There are some Pythonic errors that need to be addressed:
tests/test_datatypes.py:149:51: E711 [] Comparison to
None
should becond is None
tests/test_datatypes.py:312:50: E711 [] Comparison toNone
should becond is None
tests/test_datatypes.py:337:52: E711 [] Comparison toNone
should becond is None
tests/test_datatypes.py:362:51: E711 [] Comparison toNone
should becond is None
tests/test_datatypes.py:432:50: E711 [] Comparison toNone
should becond is None
tests/test_datatypes.py:457:51: E711 [] Comparison toNone
should becond is None
tests/test_datatypes.py:482:49: E711 [] Comparison toNone
should becond is None
Found 7 errors. [] 7 potentially fixable with the --fix option. Error: Process completed with exit code 1.
At least I don't see any harm in merging this, so let's go forward with it.
Could you also add this for the Hours2 datatype
Done
the
.raw
is set toNone
. If the heat pump only returns 500 parameters (indicated bylength
), then theraw
values of all the other parameters is stillNone
.That might be a good explanation. Is this something we should handle in the code, or if this is expected behaviour? Where have you seen / derived the
500
from?
Here, 500 just was a number smaller than the number of current parameters.
In case the firmware does not support a given parameter listet in any of the know calculations (at least that's where the issue happened for me) it will return
None
and plugging that into any of the various mathematical calculations insidedatatypes.py
leads to exceptions. This PR handles them gracefully.