Skip to content

Commit

Permalink
Add compatibility feature
Browse files Browse the repository at this point in the history
Closes Bouni#168
  • Loading branch information
gerw committed Feb 23, 2024
1 parent 14bc7b8 commit 34d1617
Show file tree
Hide file tree
Showing 3 changed files with 1,970 additions and 0 deletions.
42 changes: 42 additions & 0 deletions luxtronik/compatibilities.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Compatibility mappings for the luxtronik module"""

LUXTRONIK_COMPATIBILITIES = {
"Unknown_Parameter_1092": "ID_Einst_SuSilence",
"Unknown_Parameter_1093": "ID_Einst_SilenceTimer_0",
"Unknown_Parameter_1094": "ID_Einst_SilenceTimer_1",
"Unknown_Parameter_1095": "ID_Einst_SilenceTimer_2",
"Unknown_Parameter_1096": "ID_Einst_SilenceTimer_3",
"Unknown_Parameter_1097": "ID_Einst_SilenceTimer_4",
"Unknown_Parameter_1098": "ID_Einst_SilenceTimer_5",
"Unknown_Parameter_1099": "ID_Einst_SilenceTimer_6",
"Unknown_Parameter_1100": "ID_Einst_SilenceTimer_7",
"Unknown_Parameter_1101": "ID_Einst_SilenceTimer_8",
"Unknown_Parameter_1102": "ID_Einst_SilenceTimer_9",
"Unknown_Parameter_1103": "ID_Einst_SilenceTimer_10",
"Unknown_Parameter_1104": "ID_Einst_SilenceTimer_11",
"Unknown_Parameter_1105": "ID_Einst_SilenceTimer_12",
"Unknown_Parameter_1106": "ID_Einst_SilenceTimer_13",
"Unknown_Parameter_1107": "ID_Einst_SilenceTimer_14",
"Unknown_Parameter_1108": "ID_Einst_SilenceTimer_15",
"Unknown_Parameter_1109": "ID_Einst_SilenceTimer_16",
"Unknown_Parameter_1110": "ID_Einst_SilenceTimer_17",
"Unknown_Parameter_1111": "ID_Einst_SilenceTimer_18",
"Unknown_Parameter_1112": "ID_Einst_SilenceTimer_19",
"Unknown_Parameter_1113": "ID_Einst_SilenceTimer_20",
"Unknown_Calculation_232": "Vapourisation_Temperature",
"Unknown_Calculation_233": "Liquefaction_Temperature",
"Unknown_Calculation_236": "ID_WEB_Freq_VD_Soll",
"Unknown_Calculation_237": "ID_WEB_Freq_VD_Min",
"Unknown_Calculation_238": "ID_WEB_Freq_VD_Max",
"Unknown_Calculation_239": "VBO_Temp_Spread_Soll",
"Unknown_Calculation_240": "VBO_Temp_Spread_Ist",
"Circulation_Pump": "HUP_PWM",
"Unknown_Calculation_242": "HUP_Temp_Spread_Soll",
"Unknown_Calculation_243": "HUP_Temp_Spread_Ist",
"Unknown_Calculation_258": "RBE_Version",
"ID_Visi_Heizung_Zeitschlaltprogramm": "ID_Visi_Heizung_Zeitschaltprogramm",
}

LUXTRONIK_OBSOLETE = {
"ID_WEB_SoftStand": '"ID_WEB_SoftStand" is deprecated. Use "get_firmware_version()" of Luxtronik class.',
}
13 changes: 13 additions & 0 deletions luxtronik/data_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import logging

from luxtronik.datatypes import Unknown
from luxtronik.compatibilities import LUXTRONIK_COMPATIBILITIES, LUXTRONIK_OBSOLETE


class ObsoleteKeyError(Exception):
pass


class DataVector:
Expand Down Expand Up @@ -46,6 +51,14 @@ def _lookup(self, target, with_index=False):
except ValueError:
# Get entry by name
target_index = None

if target_index is None:
# Resolve compatibility mapping
target = LUXTRONIK_COMPATIBILITIES.get(target, target)

if target in LUXTRONIK_OBSOLETE:
raise ObsoleteKeyError(LUXTRONIK_OBSOLETE[target])

for index, entry in self._data.items():
if entry.name == target:
target_index = index
Expand Down
Loading

0 comments on commit 34d1617

Please sign in to comment.