Skip to content

Commit

Permalink
Merge pull request #5 from Tom-Bom-badil/develop
Browse files Browse the repository at this point in the history
merge develop branch
  • Loading branch information
Tom-Bom-badil authored Dec 28, 2024
2 parents d122680 + c0936cb commit 0fb0c7e
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 16 deletions.
42 changes: 34 additions & 8 deletions custom_components/helios_vallox_ventilation/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions custom_components/helios_vallox_ventilation/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
4 changes: 2 additions & 2 deletions custom_components/helios_vallox_ventilation/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
85 changes: 85 additions & 0 deletions custom_components/helios_vallox_ventilation/ventcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0fb0c7e

Please sign in to comment.