-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Milestone
Description
The base class for all datatypes is Base, which looks as follows:
python-luxtronik/luxtronik/datatypes.py
Lines 6 to 28 in 34f4e66
| class Base: | |
| """Base datatype, no conversions.""" | |
| measurement_type = None | |
| def __init__(self, name, writeable=False): | |
| self.value = None | |
| self.name = name | |
| self.writeable = writeable | |
| def to_heatpump(self, value): | |
| """Convert a value into heatpump units.""" | |
| return value | |
| def from_heatpump(self, value): | |
| """Convert a value from heatpump units.""" | |
| return value | |
| def __repr__(self): | |
| return str(self.value) | |
| def __str__(self): | |
| return str(self.value) |
All other datatypes are derived from that. I'm currently wondering what the attribute value is actually used for in this context. The __repr__ and __str__ methods are referring to it, but actually the value is never set (other than during initialization). Any invocation of from_heatpump and to_heatpump will just calculate and return the value, but never set it.
Is this attribute actually needed and if so, what for and how is it used? Am I missing something here?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels