-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Understanding what the parameters/calculations mean #35
Comments
@pmatos You'll find the "documentation" of parameters and calculation and how they interact with each other in the source code of
Essentially this is a way to structure / abstract the code to have a Python representation of the data sent to and received from the controller. You'll need to understand a little bit of Python to understand why the code is structured in this way. The actual meaning is not known for some/many of those parameters, since there is no public documentation and this is "only" a project based on reverse engineering. |
Turns out print all values was actually quite easy: from luxtronik import Luxtronik, datatypes
l = Luxtronik('192.168.178.74', 8889)
print('Parameters')
for idx in range(1126):
if not isinstance(l.parameters.get(idx), datatypes.Unknown):
print('{} : {} {}'.format(idx, l.parameters.get(idx), l.parameters.get(idx).measurement_type))
print('Calculations')
for idx in range(260):
calc = l.calculations.get(idx)
if not l.calculations.get(idx):
print('WARN: calculation {} is None'.format(idx))
elif not isinstance(l.calculations.get(idx), datatypes.Unknown):
print('{} : {} {}'.format(idx, l.calculations.get(idx), l.calculations.get(idx).measurement_type)) I understand that there's not much documentation. Still, I thought that we could work on a file that could contain things like
and sort of create a community-led file that could explain what things are. the IDs by themselves are sometimes but not often self-explanable. |
Well, a "human-understandable" explanation might indeed be helpful. I'm just wondering whether it is a good idea to have it in a separate list (which will get outdated), or whether we should add some meta information into the code for every datatype? @Bouni any preferences? I'm willing to document what I know, just wondering how best to start here. |
Thanks @kbabioch for helping out with this! First of all, this must happen within the luxtronik python module rather than her in the home-assistant integration, so I'll transfer this issue. |
It's totally legit to have something like this: # https://github.com/Bouni/python-luxtronik/blob/main/luxtronik/calculations.py#L53
10: Celsius("ID_WEB_Temperatur_TVL", "Temperatur Vorlauf"), The big downside is that we do not have language support like this and German is far from ideal. Ideally we would utilize gettext but I've never used it before and need to look into it. @kbabioch are you familiar with gettext? |
I'm familiar with gettext and have used it across some projects (although not necessarily with Python). However I'm not yet convinced that "abusing" strings as part of the class is the right way to document the parameters. While something like In a perfect world the documentation should also contain more details, i.e. what this parameter means (physically), what the allowed values are (data type, min, max, etc.). Typically I would suggest to use docstrings for this, so that the documentation lives next to the code to ensure it stays consistent as good as possible. There are some problems though:
|
Maybe the docs could live in a seperate file and matched by the id, that way we could have a proper name, description, min, max etc. as well as i18n support (at least thats waht I assume, nver really used it) Something like docs.py paramter_docs = {
...
10: {
"name": _("Vorlauftemperatur"),
"description": _("bla bla"),
"min": 10.0,
"max": 50.0
},
...
}
I guess we need to pass the id then into the class to have it available for getting the docs, something like |
Can we add a unique textual |
@BenPru You mean like the example you posted here: #41 (comment) ? |
Yes |
Was this just a made up example or did you actually start to implement and test this somewhere? |
Just example and perhaps to direct use for @kbabioch 😃. |
@kbabioch @Bouni |
@BenPru You mean having the translations in this core module and for example pass a language code to the Luxtronik calls and then it returns the already translated names? That sounds good to me! |
Another possibility would be to put the descriptions of the parameters into a json file. |
I like this idea very much. Don't care too much about the exact format of this file (JSON, YAML, Python, etc.). During initialization that file can then be read and used by the library. This file could then be easily edited / translated by other means and it is rather easy to update it without touching the code. What kind of data do we need to store / manage for each parameter / visibility / calculations? |
Hi,
I have a few questions:
For example, If I open my Alpha Innotec Control application I can see values and explanations, I was wondering if I could print all values available and try to associate them to an explanation of what they are. I could then add to the documentation you already publicly have. What do you think?
Also, is there a way to cycle through all parameters, calculations and print their values?
The text was updated successfully, but these errors were encountered: