arjenbos / ha_alpha_home

A custom Home Assistant integration for Alpha Innotec heat pumps.
Apache License 2.0
5 stars 1 forks source link

Climate entity incorrectly showing 'Cooling to Target' #3

Closed evdb-arne closed 11 months ago

evdb-arne commented 12 months ago

First of all: thanks for the great work on this integration!

There is a small issue with the climate entities showing 'cooling to target' when cooling is enabled for that room. The controller API response is misinterpreted because "cooling": true and "coolingEnabled": true merely indicate that the room is allowed to use cooling. It does not mean that cooling is currently active for the room. It also does not mean that if "cooling" is false that the room is heating to the set target.

To solve this, I'd suggest updating the logic in climate.py

    def hvac_action(self) -> HVACAction | None:
        if not self.thermostat.cooling_enabled:
            return None

        if self.thermostat.cooling:
            return HVACAction.COOLING

        return HVACAction.HEATING

This whole logic could probably be removed as it provides no value. The default HVAC action of 'Auto' is correct: it simply shows the current and target temperature, the controller and gateway have no information if cooling or heating is currently active to achieve the target temperature.

arjenbos commented 12 months ago

Thanks @arnebret !

And thank you very much in clarifying the behaviour of the API. Interpreting an API without documentation is very challenging.

I removed the hvac_action function in a new pull request. Can you have a look to verify?

evdb-arne commented 12 months ago

@arjenbos Looks good, all climate entities now show 'Auto'. Don't see any errors in the logs while testing and all works as supposed to.

PS: I mentioned in my original post that the controller and gateway have no information on the cooling/heating status, but that's not strictly true. The information is there (you can see it in the 'xpert only' panel on the controller), but it's not available on any of the endpoints I can find or that your integration is using. Would be a 'nice to have' to add if we ever find an endpoint that has this status available.

arjenbos commented 11 months ago

Thanks for testing @arnebret ! I will release a 1.0.1 version with the bug fix.

I will have a look at the expert panel. The API endpoint that's used in the expert panel is a new adventure. I need to "reverse engineer" the used javascript to generate the requests (without damaging heat pumps).