Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions luxtronik/definitions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class LuxtronikDefinition:
"since": "",
"until": "",
"datatype": "",
"bit_offset": None,
"bit_count": None,
"description": "",
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
66 changes: 66 additions & 0 deletions luxtronik/definitions/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from typing import Final

from luxtronik.datatypes import (
Bool,
BufferType,
CelsiusInt16,
CelsiusUInt16,
Expand All @@ -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,
Expand Down