Added support for controlling a second relay for cooling. #441
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!