BenPru / luxtronik

Luxtronik integration for Home Assistant
MIT License
76 stars 28 forks source link

Solar detection broken #71

Closed rhammen closed 1 year ago

rhammen commented 1 year ago

HA now reports that I have

I think this changed * Optimize solar detection caused this. The values in my case (where there is no solar buffer): Solar Collector = 5.0 C Solar Buffer = 150.0 C

The OR function in line 159 then triggers the detection: SolarPresent = (sensor_value > 0 or working_hours > 0.01 or solar_koll > 0 or solar_buffer > 0) Can we change this to: SolarPresent = (sensor_value > 0 or working_hours > 0.01) or if that causes problem to something like: SolarPresent = (sensor_value > 0 or working_hours > 0.01 or solar_koll !=5 or solar_buffer != 150)

Kars-de-Jong commented 1 year ago

I can confirm this issue, I have the same temperature readings.

rhammen commented 1 year ago

It appears that detect_solar_present() is not used (temporarily disabled) for the solar parameters in sensor.py Instead a separate detection based on the visibilities is used... This made trying out things a bit confusing... In my local setup I now re-enabled usage of detect_solar_present(), and used this:

 def detect_solar_present(self):
        sensor_value = self.get_value(LUX_DETECT_SOLAR_SENSOR)
        solar_koll = self.get_value("calculations.ID_WEB_Temperatur_TSK")
        solar_buffer = self.get_value("calculations.ID_WEB_Temperatur_TSS")
        working_hours = self.get_value("parameters.ID_BSTD_Solar")
        SolarPresent = (sensor_value > 0 or working_hours > 0.01 or solar_koll !=5 or solar_buffer != 150)
        LOGGER.info(f"{sensor_value}, WH={working_hours}, solar_koll={solar_koll}, solar_buffer={solar_buffer}")
        LOGGER.info(f"SolarPresent = {SolarPresent}") 
        return SolarPresent

This way the solar sensors are not not added to my local setup.

Kars-de-Jong commented 1 year ago

It indeed looks like detecting options based on visibilities doesn't work reliably.

Maybe make the check based on default temperatures an and condition:

        SolarPresent = (sensor_value > 0 or working_hours > 0.01 or (solar_koll != 5 and solar_buffer != 150))
BenPru commented 1 year ago

I use more and more the original luxtronik visibilities. But it seems that many heatpumps has a wrong visibility config. I have changed the behavior in the latest pre-release 2023.01.25. Currently I'm focusing on the new code base, but I try to implement those "specials": https://github.com/BenPru/luxtronik/blob/core-preview/custom_components/luxtronik/coordinator.py#L356