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

Create a VersionChild datatype #123

Closed gerw closed 1 year ago

gerw commented 1 year ago

This works towards #122.

In calculations.py we have an exceptional handling for the fields 81-90, since these ten fields contain the version information. Positions 82-90 were uninhabited; with this patch, a new VersionChild sits there and gobbles the value for its parent.

A new flag datatype_internal indicates, that this datatype is only internal and the iterator of Calculations will skip this entry.

kbabioch commented 1 year ago

There seem to be two issues with pylint (as already noted).

 luxtronik/datatypes.py:354:4: W0236: Method 'value' was expected to be 'property', found it instead as 'method' (invalid-overridden-method)
************* Module tests.test_datatypes
tests/test_datatypes.py:713:15: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
kbabioch commented 1 year ago

Other input from @Bouni et al. might also be welcome ;-).

gerw commented 1 year ago

There seem to be two issues with pylint (as already noted).

 luxtronik/datatypes.py:354:4: W0236: Method 'value' was expected to be 'property', found it instead as 'method' (invalid-overridden-method)
************* Module tests.test_datatypes
tests/test_datatypes.py:713:15: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)

Yes, but I do not understand how to fix it.

gerw commented 1 year ago

I realized another possibility which seems to (almost) remove the exceptional handling:

Bouni commented 1 year ago

@gerw That seems like the right way to solve this to me 👍🏽

kbabioch commented 1 year ago

I realized another possibility which seems to (almost) remove the exceptional handling:

  • We introduce a new datatype character which just converts 1 raw value in the corresponding character.
  • Parameters 81-90 get this new datatype (and they will store one character of the version string)
  • The version string is provided by the new higher-level interface from Provide high level interface #119

That sounds also more "keep it simple"-like to me and introduces less complexity in the interpretation of the raw data by the current datatypes.

So I would definitely prefer that.

gerw commented 1 year ago

@Bouni @kbabioch Done.