Skip to content

Commit

Permalink
init after refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
marq24 committed Feb 20, 2024
1 parent b1aee0f commit e8de8ef
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 185 deletions.
14 changes: 2 additions & 12 deletions custom_components/waterkotte_heatpump/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from homeassistant.const import UnitOfTemperature, PERCENTAGE, UnitOfEnergy, UnitOfPower, UnitOfPressure, UnitOfTime

from custom_components.waterkotte_heatpump.pywaterkotte_ha.const import SIX_STEPS_MODES
from custom_components.waterkotte_heatpump.pywaterkotte_ha.const import HEATING_MODES
from custom_components.waterkotte_heatpump.pywaterkotte_ha import EcotouchTag

# Base component constants
Expand All @@ -35,8 +35,7 @@
# # #### Enum Options ####
ENUM_ONOFFAUTO: Final = [STATE_ON, STATE_OFF, STATE_AUTO]
ENUM_OFFAUTOMANUAL: Final = [STATE_OFF, STATE_AUTO, STATE_MANUAL]
ENUM_HEATING_MODE: Final = list(SIX_STEPS_MODES.values())
ENUM_VENT_OPERATION_MODE: Final = list(SIX_STEPS_MODES.values())
ENUM_HEATING_MODE: Final = list(HEATING_MODES.values())

# Configuration and options
CONF_ENABLED: Final = "enabled"
Expand Down Expand Up @@ -961,15 +960,6 @@ class ExtSwitchEntityDescription(SwitchEntityDescription):
icon="mdi:radiator",
entity_registry_enabled_default=True,
options=ENUM_HEATING_MODE,
),
ExtSelectEntityDescription(
key="BASICVENT_OPERATION_MODE_I4582",
name="basicvent_operation_mode_i4582",
tag=EcotouchTag.BASICVENT_OPERATION_MODE_I4582,
device_class=DEVICE_CLASS_ENUM,
icon="mdi:hvac",
entity_registry_enabled_default=False,
options=ENUM_VENT_OPERATION_MODE,
)
]
SENSOR_SENSORS = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
EASYCON,
SERIES,
SYSTEM_IDS,
SIX_STEPS_MODES,
HEATING_MODES,
TRANSLATIONS
)

Expand Down
14 changes: 7 additions & 7 deletions custom_components/waterkotte_heatpump/pywaterkotte_ha/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

ECOTOUCH: Final = "ECOTOUCH"
EASYCON: Final = "EASYCON"
SIX_STEPS_MODES: Final = {
0: "mode0",
1: "mode1",
2: "mode2",
3: "mode3",
4: "mode4",
5: "mode5"
HEATING_MODES: Final = {
0: "hm0",
1: "hm1",
2: "hm2",
3: "hm3",
4: "hm4",
5: "hm5"
}
SERIES: Final = [
"Custom",
Expand Down
140 changes: 9 additions & 131 deletions custom_components/waterkotte_heatpump/pywaterkotte_ha/ecotouch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from custom_components.waterkotte_heatpump.pywaterkotte_ha.const import (
SERIES,
SYSTEM_IDS,
SIX_STEPS_MODES
HEATING_MODES
)

from custom_components.waterkotte_heatpump.pywaterkotte_ha.error import (
Expand Down Expand Up @@ -163,19 +163,19 @@ def _encode_state(self, value, encoded_values):
elif value == "manual":
encoded_values[ecotouch_tag] = "2"

def _decode_six_steps_mode(self, str_vals: List[str], *other_args): # pylint: disable=unused-argument
def _decode_heat_mode(self, str_vals: List[str], *other_args): # pylint: disable=unused-argument
assert len(self.tags) == 1
intVal = int(str_vals[0])
if intVal >= 0 and intVal <= len(SIX_STEPS_MODES):
return SIX_STEPS_MODES[intVal]
if intVal >= 0 and intVal <= len(HEATING_MODES):
return HEATING_MODES[intVal]
else:
return "Error"

def _encode_six_steps_mode(self, value, encoded_values):
def _encode_heat_mode(self, value, encoded_values):
assert len(self.tags) == 1
ecotouch_tag = self.tags[0]
assert ecotouch_tag[0] in ["I"]
index = self._get_key_from_value(SIX_STEPS_MODES, value)
index = self._get_key_from_value(HEATING_MODES, value)
if index is not None:
encoded_values[ecotouch_tag] = str(index)

Expand Down Expand Up @@ -435,8 +435,8 @@ class EcotouchTag(TagData, Enum): # pylint: disable=function-redefined

# TEMPERATURE_HEATING_BUFFERTANK_ROOM_SETPOINT = TagData(["A413"], "°C", writeable=True)

TEMPERATURE_HEATING_MODE = TagData(["I265"], writeable=True, decode_function=TagData._decode_six_steps_mode,
encode_function=TagData._encode_six_steps_mode)
TEMPERATURE_HEATING_MODE = TagData(["I265"], writeable=True, decode_function=TagData._decode_heat_mode,
encode_function=TagData._encode_heat_mode)
# this A32 value is not visible in the GUI - and IMHO (marq24) there should
# be no way to set the heating temperature directly - use the values of the
# 'TEMPERATURE_HEATING_HC' instead (HC = HeatCurve)
Expand Down Expand Up @@ -712,127 +712,5 @@ class EcotouchTag(TagData, Enum): # pylint: disable=function-redefined
# lngD799 = ["SG4: Zwangslauf", "SG4: Forced run", "SG4: Marche forc\xe9e"],
SGREADY_SG4_FORCE_RUN_D799 = TagData(["D799"], writeable=False)

##################################################################################
# BASICVENT / ECOVENT Stuff...
# PID-Regler: Proportional-Integral-Differenzial-Regler
##################################################################################
# A4387: uom: '', 'Energieersparnis gesamt'
BASICVENT_ENERGY_SAVE_TOTAL_A4387 = TagData(["A4387"], writeable=False)
# A4389: uom: '', 'Energieersparnis aktuell'
BASICVENT_ENERGY_SAVE_CURRENT_A4389 = TagData(["A4389"], writeable=False)
# A4391: uom: '', 'Wärmerückgewinnungsgrad'
BASICVENT_HEAT_RECOVERY_RATE_A4391 = TagData(["A4391"], writeable=False)

# A4498: uom: 'h', 'Luftfilter Wechsel Betriebsstunden'
BASICVENT_AIR_FILTER_CHANGE_OPERATING_HOURS_A4498 = TagData(["A4498"], writeable=False)
# A4504: uom: 'Tage', 'Luftfilter Wechsel Betriebsstunden Restlaufzeit dd'
BASICVENT_AIR_FILTER_CHANGE_REMAINING_OPERATING_DAYS_A4504 = TagData(["A4504"], writeable=False)
# D1544: uom: '', 'Luftfilter Wechsel Betriebsstunden Reset'
BASICVENT_AIR_FILTER_CHANGE_OPERATING_HOURS_RESET_D1544 = TagData(["D1544"], writeable=False)
# D1469: uom: '', 'Luftfilter Wechselanzeige'
BASICVENT_AIR_FILTER_CHANGE_DISPLAY_D1469 = TagData(["D1469"], writeable=False)
# D1626: uom: '', 'Luftfilter Wechselanzeige Animation'
BASICVENT_AIR_FILTER_CHANGE_DISPLAY_ANIMATION_D1626 = TagData(["D1626"], writeable=False)

# A4506: uom: '', 'Hu Luftfeuchtigkeit PID'
BASICVENT_HUMIDITY_SETPOINT_A4506 = TagData(["A4506"], writeable=True)
# A4508: uom: '', 'Hu Luftfeuchtigkeit Sollwert'
BASICVENT_HUMIDITY_DEMAND_A4508 = TagData(["A4508"], writeable=False)
# A4510: uom: '', 'Hu Luftfeuchtigkeit'
BASICVENT_HUMIDITY_VALUE_A4510 = TagData(["A4510"], writeable=False)
# A4990: uom: '', 'Luftfeuchtigkeit'
BASICVENT_HUMIDITY_SECOND_VALUE_A4990 = TagData(["A4990"], writeable=False)

# A4512: uom: '', 'CO2-Konzentration PID'
BASICVENT_CO2_SETPOINT_A4512 = TagData(["A4512"], writeable=True)
# A4514: uom: '', 'CO2-Konzentration Sollwert'
BASICVENT_CO2_DEMAND_A4514 = TagData(["A4514"], writeable=False)
# A4516: uom: '', 'CO2-Konzentration'
BASICVENT_CO2_VALUE_A4516 = TagData(["A4516"], writeable=False)
# A4992: uom: '', 'CO2'
BASICVENT_CO2_SECOND_VALUE_A4992 = TagData(["A4992"], writeable=False)

# A4518: uom: '', 'VOC Kohlenwasserstoffverbindungen PID'
BASICVENT_VOC_SETPOINT_A4518 = TagData(["A4518"], writeable=True)
# A4520: uom: '', 'VOC Kohlenwasserstoffverbindungen Sollwert'
BASICVENT_VOC_DEMAND_A4520 = TagData(["A4520"], writeable=False)
# A4522: uom: '', 'VOC Kohlenwasserstoffverbindungen'
BASICVENT_VOC_VALUE_A4522 = TagData(["A4522"], writeable=False)

# I4523: uom: '', 'Luftqualitaet Messung VOC CO2 Sensor'
# I4582: uom: '', opts: { type:'select', options: ['Tag','Nacht','Zeitprogramm','Party','Urlaub','Bypass'] }, 'i_Mode'
BASICVENT_OPERATION_MODE_I4582 = TagData(["I4582"], writeable=True, decode_function=TagData._decode_six_steps_mode,
encode_function=TagData._encode_six_steps_mode)

# mdi:air-filter
# mdi:hvac
# mdi:wind-power

# A4549: uom: '', 'Luefter 1 Rueckmeldung'
# D1605: uom: '', 'Luefter 1 - Manuell Drehzahl'
# A4551: uom: 'U/min', 'Luefter 1 Umdrehungen pro Minute'
# BASICVENT_INCOMMING_AIR_DRIVE_RPM
# A4986: uom: '%', 'Analogausgang Y1' - Rotation Incoming air drive percent
# BASICVENT_INCOMMING_AIR_DRIVE
# A4996: uom: '', 'T3'
# BASICVENT_T_INCOMMING_AIR

# A4545: uom: '', 'Luefter 2 Rueckmeldung'
# D1603: uom: '', 'Luefter 2 - Manuell Drehzahl'
# A4547: uom: 'U/min', 'Luefter 2 Umdrehungen pro Minute'
# BASICVENT_ONGOING_AIR_DRIVE_RPM
# A4984: uom: '%', 'Analogausgang Y2' - Rotation Ongoing air drive percent
# BASICVENT_ONGOING_AIR_DRIVE
# A4994: uom: '', 'T4'
# BASICVENT_T_ONGOING_AIR

# A5000: uom: '', 'T1'
# BASICVENT_T_EXTERNAL_AIR
# A4998: uom: '', 'T2'
# BASICVENT_T_EXAUSTING_AIR

# D1432: uom: '', 'Bypass Aktiv' -
# D1433: uom: '', 'HU En'
# D1465: uom: '', 'Comfort-Bypass'
# D1466: uom: '', 'Smartbypass'
# D1503: uom: '', 'Holiday enabled'

#############################
# UNKNOWN BASIC VENT VALUES #
#############################
# A4420: uom: '', 'Luftmenge Stufe 2 - Nennlüftung NL'

# A4525: uom: '', 'Schutzfunktion Ablufttemperatur Schaltdifferenz'
# A4527: uom: '', 'Schutzfunktion Ablufttemperatur Unterbrechung'
# A4529: uom: '', 'Schutzfunktion Ablufttemperatur Warnung'

# A4531: uom: '', 'Frostschutzfunktion Fortluft EHH NotAus'
# A4533: uom: '', 'Frostschutzfunktion Taktbetrieb High'
# A4535: uom: '', 'Frostschutzfunktion Taktbetrieb Low'
# A4537: uom: '', 'Frostschutzfunktion Schaltdifferenz'
# A4539: uom: '', 'Frostschutzfunktion Fortluft EHH'
# A4541: uom: '', 'Frostschutzfunktion Aussenluft ODA'

# A4542: uom: '', 'Feuerstaetten Funktion FPF Betriebsmodus Abluft'
# A4543: uom: '', 'Feuerstaetten Funktion FPF Betriebsmodus Aussenluft'

# D1488: uom: '', 'Warnung Wxxx'
# D1489: uom: '', 'Fehler Fxxx'
# D1490: uom: '', 'Fehler Fxxx'
# D1491: uom: '', 'Fehler Fxxx'

# D1508: uom: '', 'Frostschutz Auskuehlschutz T1'
# D1507: uom: '', 'Frostschutz Auskuehlschutz T2'

# D1627: uom: '', 'Feuerstaetten Funktion FPF Animation'
# D1628: uom: '', 'Rauchmelder Brandschutz Funktion SDF Animation'
# D1629: uom: '', 'Frostschutzfunktion Aussenluft ODA FALSE OK'

# D2035: uom: '', 'Anschlussseite Rechts TRUE oder Rechts FALSE'
# D2036: uom: '', 'Anschlussseite Links TRUE oder Rechts FALSE'
# I2331: uom: '', 'TT_b_enabled[5,6]'
# I2484: uom: '', 'TT_b_enabled[5,2]'
# I2889: uom: '', 'TT_b_enabled[6,5]'

def __hash__(self) -> int:
def __hash__(self) -> int:
return hash(self.name)
23 changes: 6 additions & 17 deletions custom_components/waterkotte_heatpump/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,12 @@
"temperature_heating_mode": {
"name": "Heizungsregelung",
"state": {
"mode0": "Witterungsgeführt",
"mode1": "Manuelle Sollwertvorgabe",
"mode2": "Sollwertvorgabe BMS",
"mode3": "Sollwertvorgabe EXT",
"mode4": "Sollwertvorgabe 0-10V",
"mode5": "Mischerkreis Vorgabe"
}
},
"basicvent_operation_mode_i4582": {
"name": "Lüfter Betriebsmodus",
"state": {
"mode0": "Tag",
"mode1": "Nacht",
"mode2": "Zeitprogramm",
"mode3": "Party",
"mode4": "Urlaub",
"mode5": "Bypass"
"hm0": "Witterungsgeführt",
"hm1": "Manuelle Sollwertvorgabe",
"hm2": "Sollwertvorgabe BMS",
"hm3": "Sollwertvorgabe EXT",
"hm4": "Sollwertvorgabe 0-10V",
"hm5": "Mischerkreis Vorgabe"
}
},
"enable_cooling": {"name": "Betriebsmodus Kühlung"},
Expand Down
23 changes: 6 additions & 17 deletions custom_components/waterkotte_heatpump/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,12 @@
"temperature_heating_mode": {
"name": "Heating Control",
"state": {
"mode0": "Weather-compensated",
"mode1": "Manual Setpoint",
"mode2": "Setpoint BMS",
"mode3": "Setpoint EXT",
"mode4": "Setpoint 0-10V",
"mode5": "Based on Mixing circle"
}
},
"basicvent_operation_mode_i4582": {
"name": "Vent Operation mode",
"state": {
"mode0": "Day",
"mode1": "Night",
"mode2": "Scheduled",
"mode3": "Party",
"mode4": "Holiday",
"mode5": "Bypass"
"hm0": "Weather-compensated",
"hm1": "Manual Setpoint",
"hm2": "Setpoint BMS",
"hm3": "Setpoint EXT",
"hm4": "Setpoint 0-10V",
"hm5": "Based on Mixing circle"
}
},
"enable_cooling": {"name": "Operation mode cooling"},
Expand Down

0 comments on commit e8de8ef

Please sign in to comment.