raomin / ESPAltherma

Monitor your Daikin Altherma / ROTEX heat pump with ESP32
MIT License
317 stars 105 forks source link

Added support for controlling a second relay for cooling. #441

Open HarmEllis opened 3 days ago

HarmEllis commented 3 days ago

I wanted to control heating and cooling from Home Assistant.

This change adds a second switch in Home Assistant, named 'switch.altherma_cooling', but only if the 'PIN_COOL' is defined in the 'setup.h' file.

The logic will prevent from switching heating and cooling on at the same time (although a Daikin Altherma Hybrid will prever heating over cooling if both are enabled). When switching cooling on while heating is on, heating will be turned off and vice versa.

I also refactored the 'callbackTherm' function to prevent duplicate code, since there can be two relays to control now.

I had one issue with this, it seems like somehow this inverts the relay active state. I changed mine from HIGH to LOW in 'setup.h' and after that everything was working properly. I could not find out why this changed though. Maybe someone else can test and confirm this behavior.

Also, I do not have a lot of c/ c++ or mqtt experience, feedback is always welcome!