laszlojakab / homeassistant-easycontrols

Helios EasyControls Modbus TCP/IP integration for Home Assistant
MIT License
21 stars 12 forks source link

Heat recovery efficiency at zero air flow #105

Open MichaelSeitel-pts opened 11 months ago

MichaelSeitel-pts commented 11 months ago

Hi,

I like the calculation of the heat recovery efficiency rate. When fan stage is 0 and there is no airflow, I think it would be better to set the value to NaN instead of the calculated value. Although the reference doesn't consider the airflow rate either.

Explanation: When it's very cold outside I put the fan to standby during night hours. Then, the heat recovery efficiency rate goes up to huge values. That's mainly because the outside temperature no longer represents the real outside temperature. It aligns to the other temperatures inside the ventilation device. Thus, the calculation is no longer valid, in my opinion.

In sensors.py the _value_updated function could be changed as follows:

def _value_updated(self: Self, variable: ModbusVariable[Any], value: Any):
        if variable == VARIABLE_TEMPERATURE_OUTSIDE_AIR:
            self._outside_air_temperature = value
        elif variable == VARIABLE_TEMPERATURE_SUPPLY_AIR:
            self._supply_air_temperature = value
        elif variable == VARIABLE_TEMPERATURE_EXTRACT_AIR:
            self._extract_air_temperature = value
        elif variable == VARIABLE_PERCENTAGE_FAN_SPEED:
            self._percentage_fan_speed = value

        if (
            self._outside_air_temperature is None
            or self._supply_air_temperature is None
            or self._extract_air_temperature is None
            or self._percentage_fan_speed is None
            or self._percentage_fan_speed == 0
        ):
            self._attr_native_value = None
        else:
            if abs(self._extract_air_temperature - self._outside_air_temperature) > 0.5:
                self._attr_native_value = abs(
                    round(
                        (self._supply_air_temperature - self._outside_air_temperature)
                        / (
                            self._extract_air_temperature
                            - self._outside_air_temperature
                        )
                        * 100,
                        2,
                    )
                )
            else:
                self._attr_native_value = 0

        self._attr_available = self._attr_native_value is not None
        self.schedule_update_ha_state(False)