diff --git a/luxtronik/definitions/__init__.py b/luxtronik/definitions/__init__.py index a4672160..9afa9318 100644 --- a/luxtronik/definitions/__init__.py +++ b/luxtronik/definitions/__init__.py @@ -39,6 +39,8 @@ class LuxtronikDefinition: "since": "", "until": "", "datatype": "", + "bit_offset": None, + "bit_count": None, "description": "", } @@ -91,8 +93,13 @@ def __init__(self, data_dict, type_name, offset): data_type_valid = self._data_type in self.VALID_DATA_TYPES self._valid &= data_type_valid data_type_valid &= self._data_type != "" - self._num_bits = int(self._data_type.replace('U', '').replace('INT', '')) \ - if data_type_valid else 0 + self._bit_offset = data_dict["bit_offset"] + bit_count = data_dict["bit_count"] + if bit_count: + self._num_bits = bit_count + else: + self._num_bits = int(self._data_type.replace('U', '').replace('INT', '')) \ + if data_type_valid else 0 except Exception as e: self._valid = False self._index = 0 @@ -164,6 +171,10 @@ def writeable(self): def data_type(self): return self._data_type + @property + def bit_offset(self): + return self._bit_offset + @property def num_bits(self): return self._num_bits @@ -238,7 +249,7 @@ def __getitem__(self, name_or_idx): def __contains__(self, def_name_or_idx): if isinstance(def_name_or_idx, LuxtronikDefinition): - return any(def_name_or_idx is d for d in self._index_dict.values()) + return any(def_name_or_idx is d for d in self._name_dict.values()) return self._get(def_name_or_idx) is not None def _add_alias(self, definition, alias): diff --git a/luxtronik/definitions/inputs.py b/luxtronik/definitions/inputs.py index c266f528..954c8e55 100644 --- a/luxtronik/definitions/inputs.py +++ b/luxtronik/definitions/inputs.py @@ -15,6 +15,7 @@ from typing import Final from luxtronik.datatypes import ( + Bool, BufferType, CelsiusInt16, CelsiusUInt16, @@ -36,6 +37,71 @@ INPUTS_DEFAULT_DATA_TYPE: Final = 'INT16' INPUTS_DEFINITIONS_LIST: Final = [ + { + "index": 0, + "count": 1, + "names": ["heatpump_vd1_status"], + "type": Bool, + "writeable": False, + "datatype": "UINT16", + "bit_offset": 0, + "bit_count": 1, + "unit": "boolean", + "since": "3.90.1", + "description": "Indicates whether VD1 is running" + }, + { + "index": 0, + "count": 1, + "names": ["heatpump_vd2_status"], + "type": Bool, + "writeable": False, + "datatype": "UINT16", + "bit_offset": 1, + "bit_count": 1, + "unit": "boolean", + "since": "3.90.1", + "description": "Indicates whether VD2 is running" + }, + { + "index": 0, + "count": 1, + "names": ["heatpump_zwe1_status"], + "type": Bool, + "writeable": False, + "datatype": "UINT16", + "bit_offset": 2, + "bit_count": 1, + "unit": "boolean", + "since": "3.90.1", + "description": "Indicates whether ZWE1 is running" + }, + { + "index": 0, + "count": 1, + "names": ["heatpump_zwe2_status"], + "type": Bool, + "writeable": False, + "datatype": "UINT16", + "bit_offset": 3, + "bit_count": 1, + "unit": "boolean", + "since": "3.90.1", + "description": "Indicates whether ZWE2 is running" + }, + { + "index": 0, + "count": 1, + "names": ["heatpump_zwe3_status"], + "type": Bool, + "writeable": False, + "datatype": "UINT16", + "bit_offset": 4, + "bit_count": 1, + "unit": "boolean", + "since": "3.90.1", + "description": "Indicates whether ZWE3 is running" + }, { "index": 0, "count": 1,