Esphome two thermostats interlock

Hello everyone!
I have two thermostats on one Esp controlling ONE relay.

I need to make an automation so that when I switch one thermostat to “Heat” from “OFF”, the second one should immediately switch to “OFF” from “Heat” and vice versa.

It seems that I should use lambda, but I do not know C++.

Any help will be appreciated!
Thank you!

What is the use case?

Do you think I can help if that’s all I know??
Describe what you exactly have (hardware, wiring and yaml) and what you really want to accomplish.

I dont understand why you have 2 thermostats one for heat and 1 for cool when just 1 thermostat is perfectly capable of doing what you need.

What device or hardware is the second thermostat switching to Off?

You only meantioned one relay so are you switching some other relay or is this 1 relay where COM/NC is Heat and COM/NO is cool? I wouldn’t personally recommend doing that but your setup is a mystery and so is 2 thermostats.

Here is short example to catch climate mode changes and perform action on it.

climate:
  - platform: XXX
    id: cl1
...
    on_control:
      - lambda: |-
          if (x.get_mode() == CLIMATE_MODE_OFF) {
            id(cl2).make_call().set_mode("HEAT").perform();
          }

climate:
  - platform: XXX
    id: cl2

Tune for Your needs.

1 Like

Or you could just link to the documentation where many basic examples like this can be found…

1 Like

I think I should describe my setup in details.
I have a boiler which is controlled using dry contact - ON and OFF.
I have a ESP with relay, which controls the dry contact.

During winter the boiler is used for heating of my house, using indoor temperature.
During summer the boiler is used to heat the pool, using water temperature.

Therefore, I have TWO “virtual” thermostats one for winter, one for summer. However, they should “interlock” each other, not to work at the same time. So, when one thermostat is switch to heating, the second one should switch off and vice versa.

Each thermostat has its own:

  1. temperature range
  2. temperature source

If anyone has other suggestions how I can arrange this work, I would be grateful for your suggestions.

This works as I wanted, thank you!

If there are any other suggestions how to implement two temperature sources and two temperature ranges, please let me know.

So, make 2 thermostats. One for summer/heating pool and the other for heating the house.

Since only one thermostat should be active then how do we do that? You have a few ways of doing that.

  1. Both thermostats start in the “OFF” mode/preset untill you manually activate one.

  2. Check condition/s. You can check for seasons, specific dates/months. For example here in the US the swimming pools always open on Memorial day(May 27) and they always close on Labor day(September 2). So for me I could check conditions like this.

  3. Is Season Fall OR Winter

  4. Is Season Spring or Summer?

  5. Is current date May 27 or is it after May 27 and before Sept 2?

So, condition 1 didnt pass. Its not fall or winter.
Condition 2 is true, the current season is Spring and condition 3 also passed, the current date is between May27-Sept.2.

Since those are true we know its summer and the pool is what needs heat, therfore set “Summer Thermostat” from Mode - Off or Preset Off to Mode Auto or your custom Preset #, or Heat mode etc, etc.