diff --git a/custom_components/helios_vallox_ventilation/configuration.yaml b/custom_components/helios_vallox_ventilation/configuration.yaml index 658ec9a..927ff74 100644 --- a/custom_components/helios_vallox_ventilation/configuration.yaml +++ b/custom_components/helios_vallox_ventilation/configuration.yaml @@ -34,25 +34,25 @@ default_value: 8 icon: "mdi:speedometer" - - name: "outside_temp" + - name: "temperature_outside" unit_of_measurement: "°C" device_class: "temperature" state_class: "measurement" # this means "read-only" icon: "mdi:thermometer" - - name: "inlet_temp" + - name: "temperature_inlet" unit_of_measurement: "°C" device_class: "temperature" state_class: "measurement" icon: "mdi:thermometer" - - name: "outlet_temp" + - name: "temperature_outlet" unit_of_measurement: "°C" device_class: "temperature" state_class: "measurement" icon: "mdi:thermometer" - - name: "exhaust_temp" + - name: "temperature_exhaust" unit_of_measurement: "°C" device_class: "temperature" state_class: "measurement" @@ -133,6 +133,36 @@ state_class: "measurement" icon: "mdi:alert" + # calculated by ventcontrol.py + - name: "temperature_reduction" + friendly_name: "Heat recovery - reduction of outgoing air temperature" + unit_of_measurement: "°C" + device_class: "temperature" + state_class: "measurement" + icon: "mdi:thermometer" + + # calculated by ventcontrol.py + - name: "temperature_gain" + friendly_name: "Heat recovery - gain of incoming air temperature" + unit_of_measurement: "°C" + device_class: "temperature" + state_class: "measurement" + icon: "mdi:thermometer" + + # calculated by ventcontrol.py + - name: "temperature_balance" + friendly_name: "Difference temperature reduction ./. temperature gain" + unit_of_measurement: "°C" + device_class: "temperature" + state_class: "measurement" + icon: "mdi:thermometer" + + # calculated by ventcontrol.py + - name: "efficiency" + unit_of_measurement: "%" + state_class: "measurement" + icon: "mdi:percent" + - name: "preheat_status" # ??????????????? --> binary_sensor??? min_value: 0 max_value: 1 @@ -184,7 +214,3 @@ - name: "output_fan_off" device_class: "power" icon: "mdi:fan-off" - - # Internal developer note / todo: - # Outdoor air temperature, Extract air temperature, Supply air temperature - # Indoor air temperature diff --git a/custom_components/helios_vallox_ventilation/const.py b/custom_components/helios_vallox_ventilation/const.py index b427660..5897aa8 100644 --- a/custom_components/helios_vallox_ventilation/const.py +++ b/custom_components/helios_vallox_ventilation/const.py @@ -66,13 +66,13 @@ # Maximum settable fanspeed "max_fanspeed" : {"varid" : 0xA5, 'type': 'fanspeed', 'bitposition': -1, 'read': True, 'write': True }, # NTC5K sensors: outside air temperature - "outside_temp" : {"varid" : 0x32, 'type': 'temperature', 'bitposition': -1, 'read': True, 'write': False }, + "temperature_outside" : {"varid" : 0x32, 'type': 'temperature', 'bitposition': -1, 'read': True, 'write': False }, # NTC5K sensors: supply air temperature - "inlet_temp" : {"varid" : 0x35, 'type': 'temperature', 'bitposition': -1, 'read': True, 'write': False }, + "temperature_inlet" : {"varid" : 0x35, 'type': 'temperature', 'bitposition': -1, 'read': True, 'write': False }, # NTC5K sensors: extract / inside air temperature - "outlet_temp" : {"varid" : 0x34, 'type': 'temperature', 'bitposition': -1, 'read': True, 'write': False }, + "temperature_outlet" : {"varid" : 0x34, 'type': 'temperature', 'bitposition': -1, 'read': True, 'write': False }, # NTC5K sensors: exhaust air temperature - "exhaust_temp" : {"varid" : 0x33, 'type': 'temperature', 'bitposition': -1, 'read': True, 'write': False }, + "temperature_exhaust" : {"varid" : 0x33, 'type': 'temperature', 'bitposition': -1, 'read': True, 'write': False }, # various coils in register 0xA3 that are displayed on the remote controls (0..3 read/write, 4..7 readonly) # FB LED1: on/off Caution: Remotes will not be switched back on automatically; initial_fanspeed set if done manually. "powerstate" : {"varid" : 0xA3, 'type': 'bit', 'bitposition': 0, 'read': True, 'write': True }, diff --git a/custom_components/helios_vallox_ventilation/manifest.json b/custom_components/helios_vallox_ventilation/manifest.json index f655da5..ee162b9 100644 --- a/custom_components/helios_vallox_ventilation/manifest.json +++ b/custom_components/helios_vallox_ventilation/manifest.json @@ -5,7 +5,7 @@ "dependencies": [], "documentation": "https://github.com/Tom-Bom-badil/home-assistant_helios-vallox/wiki", "iot_class": "local_polling", - "issue_tracker": "https://github.com/Tom-Bom-badil/home-assistant_helios-vallox/issues", + "issue_tracker": "https://github.com/Tom-Bom-badil/home-assistant_helios-vallox/issues", "requirements": [], - "version": "2024.12.7" + "version": "2024.12.8" } diff --git a/custom_components/helios_vallox_ventilation/ventcontrol.py b/custom_components/helios_vallox_ventilation/ventcontrol.py index 230e95b..5cdccd3 100644 --- a/custom_components/helios_vallox_ventilation/ventcontrol.py +++ b/custom_components/helios_vallox_ventilation/ventcontrol.py @@ -327,11 +327,76 @@ def resolve_variable(self, varid, data_byte): return results + def calculate_derived_values(self, measured_values): + + try: + + # get temperatures + temp_outside = measured_values.get("temperature_outside") + temp_inlet = measured_values.get("temperature_inlet") + temp_outlet = measured_values.get("temperature_outlet") + temp_exhaust = measured_values.get("temperature_exhaust") + + # calculate reduction / gain / (dis-)balance + temperature_reduction = ( + temp_outlet - temp_exhaust + if temp_outlet is not None and temp_exhaust is not None + else None + ) + temperature_gain = ( + temp_inlet - temp_outside + if temp_inlet is not None and temp_outside is not None + else None + ) + temperature_balance = ( + temperature_reduction - temperature_gain + if temperature_reduction is not None and temperature_gain is not None + else None + ) + + # calculate efficientcy + efficiency = None + if ( + temp_inlet is not None + and temp_outside is not None + and temp_outlet is not None + ): + delta_outside = temp_outlet - temp_outside + if delta_outside == 0: + # temp_outlet == temp_outside would lead to div/0 + efficiency = 0 + elif delta_outside > 0: + efficiency = (temperature_gain / delta_outside) * 100 + else: + efficiency = 0 + # limit to 0..100% + if efficiency is not None: + efficiency = int(max(0, min(efficiency, 100))) + + return { + "temperature_reduction": temperature_reduction, + "temperature_gain": temperature_gain, + "temperature_balance": temperature_balance, + "efficiency": efficiency, + } + + except Exception as e: + logger.error(f"Fehler bei der Berechnung der abgeleiteten Werte: {e}") + return { + "temperature_reduction": None, + "temperature_gain": None, + "temperature_balance": None, + "efficiency": None, + } + + def readAllValues(self, textoutput=True): logger.debug("Helios: Reading values of all registers and coils ...") varid_groups = {} # prevent double handling of coil bytes + measured_values = {} + for varname, details in REGISTERS_AND_COILS.items(): varid = details["varid"] if varid not in varid_groups: @@ -351,6 +416,13 @@ def readAllValues(self, textoutput=True): logger.debug(f"{var_name}: {var_value}") if textoutput==True: print(f"{var_name}: {var_value}") + +# neu + # store some values for later calculation + if var_name in ["temperature_outside", "temperature_inlet", "temperature_outlet", "temperature_exhaust"]: + measured_values[var_name] = var_value +# neu + if var_name == "fault_number": error_text = COMPONENT_FAULTS.get(var_value, "none") if textoutput==True: @@ -359,6 +431,19 @@ def readAllValues(self, textoutput=True): else: logger.warning(f"Failed to resolve value for variable: {var_name}") print(f"{var_name}: Failed to resolve value") + + +# neu + if all(key in measured_values for key in ["temperature_outside", "temperature_inlet", "temperature_outlet", "temperature_exhaust"]): + calculated_values = self.calculate_derived_values(measured_values) + for calc_name, calc_value in calculated_values.items(): + if calc_value is not None: + self.GLOBAL_VALUES[calc_name] = calc_value + logger.debug(f"{calc_name}: {calc_value}") + if textoutput: + print(f"{calc_name}: {calc_value}") +# neu + else: logger.warning(f"Failed to read value for varid: {varid:02X}") for varname in varnames: diff --git a/hacs.json b/hacs.json index 00ba48c..e9dddb1 100644 --- a/hacs.json +++ b/hacs.json @@ -1,6 +1,6 @@ { "name": "Helios Pro / Vallox SE Ventilation", "content_in_root": false, - "homeassistant": "2024.12.3", + "homeassistant": "2024.12.4", "render_readme": true } diff --git a/readme.md b/readme.md index 9b05c2e..6243599 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ [![Custom integration](https://img.shields.io/badge/custom%20integration-%2341BDF5.svg)](https://www.home-assistant.io/getting-started/concepts-terminology) [![HACS](https://img.shields.io/badge/HACS%20listed-not_yet-red.svg)](https://github.com/hacs) [![HACS](https://img.shields.io/badge/HACS%20manual%20install-verified-green.svg)](https://github.com/hacs) -[![Version](https://img.shields.io/badge/Version-v2024.12.7-green.svg)](https://github.com/Tom-Bom-badil/home-assistant_helios-vallox/releases) +[![Version](https://img.shields.io/badge/Version-v2024.12.8-green.svg)](https://github.com/Tom-Bom-badil/home-assistant_helios-vallox/releases) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Tom-Bom-badil/home-assistant_helios-vallox/graphs/commit-activity) # Integration for Helios / Vallox central house ventilation systems with RS-485 bus (pre-EasyControls aka pre-2014 models)