diff --git a/luxtronik/__init__.py b/luxtronik/__init__.py index 4cb9fb0e..a1fa7181 100755 --- a/luxtronik/__init__.py +++ b/luxtronik/__init__.py @@ -63,7 +63,7 @@ def __init__(self, parameters=None, calculations=None, visibilities=None, safe=T self.visibilities = Visibilities() if visibilities is None else visibilities def get_firmware_version(self): - return "".join([self.calculations.get(i).value for i in range(81, 91)]) + return self.calculations.get_firmware_version() class LuxtronikSocketInterface: diff --git a/luxtronik/calculations.py b/luxtronik/calculations.py index 2c7ca9cf..4119f2c4 100755 --- a/luxtronik/calculations.py +++ b/luxtronik/calculations.py @@ -5,6 +5,7 @@ from luxtronik.data_vector import DataVector from luxtronik.datatypes import ( + Base, BivalenceLevel, Bool, Celsius, @@ -320,3 +321,25 @@ def __init__(self): 267: Celsius(["Desired_Room_Temperature", "Unknown_Calculation_267"]), 268: Power(["AC_Power_Input", "Unknown_Calculation_268"]), } + + @property + def calculations(self): + return self._data + + def get_firmware_version(self): + """Get the firmware version as string.""" + return "".join([super(Calculations, self).get(i).value for i in range(81, 91)]) + + def _get_firmware_version(self): + """Get the firmware version as string like in previous versions.""" + return self.get_firmware_version().strip("\x00") + + def get(self, target): + """Treats certain names specially. For all others, the function of the base class is called.""" + if target == "ID_WEB_SoftStand": + self.logger.debug("The name 'ID_WEB_SoftStand' is obsolete! Use 'get_firmware_version()' instead.") + entry = Base("ID_WEB_SoftStand") + entry.raw = self._get_firmware_version() + return entry + else: + return super().get(target) diff --git a/luxtronik/parameters.py b/luxtronik/parameters.py index e97e9395..77b57ef2 100755 --- a/luxtronik/parameters.py +++ b/luxtronik/parameters.py @@ -1207,12 +1207,16 @@ def __init__(self, safe=True): 1159: Unknown(["POWER_LIMIT_VALUE", "Unknown_Parameter_1159"]), } + @property + def parameters(self): + return self._data + def set(self, target, value): """Set parameter to new value.""" index, parameter = self._lookup(target, with_index=True) if index is not None: if parameter.writeable or not self.safe: - self.queue[index] = parameter.to_heatpump(value) + self.queue[index] = int(parameter.to_heatpump(value)) else: self.logger.warning("Parameter '%s' not safe for writing!", parameter.name) else: diff --git a/luxtronik/visibilities.py b/luxtronik/visibilities.py index 5b338270..bbdac487 100755 --- a/luxtronik/visibilities.py +++ b/luxtronik/visibilities.py @@ -397,3 +397,7 @@ def __init__(self): 378: Unknown(["Unknown_Visibility_378", "Unknown_Parameter_378"]), 379: Unknown(["Unknown_Visibility_379", "Unknown_Parameter_379"]), } + + @property + def visibilities(self): + return self._data