Thermostat Automation

Well in this case I need climate.basement_heat to change to whatever the climate.first_floor_heat is set to, which in this case is only heat or off.

If the thermostat on the first floor has more modes than just heat and off, and all you want is to focus on those two modes, change trigger so it only activates for state-changes to heat or off.

#Thermostat Automation - Turn on basement if first floor turns on
- alias: Set basement thermostat
  trigger:
  - platform: state
    entity_id: climate.first_floor_heat
    to: 'heat'
  - platform: state
    entity_id: climate.first_floor_heat
    to: 'off'
  action:
    service: climate.set_hvac_mode
    entity_id: climate.basement_heat
    data_template:
      hvac_mode: "{{ trigger.to_state.state }}"

If the first floor thermostat only has two modes, heat and off, then pnbruckner’s example is all you need to get the job done.

That’s one possibility. Another could be if the “source” could be off, heat or cool, and the “target” should be heat when the source is heat, but off if the source is off or cool, then that would be implemented differently. Hence the request for clarification.

But, it seems, the simple implementation is what is wanted. :smiley:

I actually made a mistake. I need to look at the hvac_action state insated of hvac_mode. The idea is if the first floor in “heating” then set basement to heat mode.

This is what I have now, but it doesn’t work:

#Thermostat Automation - Turn on basement if first floor turns on
- alias: Set basement thermostat
  trigger:
    platform: state
    entity_id: climate.first_floor_heat
  action:
    service: climate.set_hvac_mode
    entity_id: climate.basement_heat
    data_template:
     hvac_mode: >
          {% if state_attr('climate.first_floor_heat', 'hvac_action', heating) %}
            heat
          {% else %}
            off
          {% endif %}

Because you did not quote heating. Without quotes there would have to be a variable named heating, which there isn’t.

          {% if state_attr('climate.first_floor_heat', 'hvac_action', 'heating') %}

Only set the basement thermostat to heat mode when the first floor thermostat is actively heating?

Weird.

I can understand syncing the modes of the two thermostats at all times but not limited to when one is actively heating. Anyway, your automated house, your automations.

Yeah, I just answered how without thinking about why. I’ve played with the climate component in newer versions, but my main system is still running 0.95.4 (for many reasons), so I wasn’t sure why he’d want to use that attribute vs the state (or even what that attribute actually meant.) Maybe he shouldn’t be.

I can see how this could throw you off a bit. My basement is pretty much warmer than the rest of the house. I have radiant heat on all three floors. I didn’t want to heat the basement by itself not to waist energy. For that reason I want to heat the basement only when the first floor is actually heating, not just in heat mode.

I’d counter with “heat rises” so whatever heating that occurs in the basement isn’t wasted, it also warms (at the very least) the floor above it.

The arrangement you’ve proposed (between the basement and first floor thermostats) simply means the first floor thermostat is the primary controller for both the first floor and basement. If the area being heated on both floors is nearly identical then all’s well. However, if the basement is larger, it means its temperature is likely to remain less than on the first floor (more volume to heat, less time allotted to heat it). Conversely, if the basement is smaller then its temperature will be higher than the first floor (less volume to heat, more time allotted to heat it).

Let us know if the arrangement works well for you.
If you’re concerned about non-essential heating of the basement, and you’re not a proponent of ‘heat rises’, then just set the basement temperature to the barest livable minimum. Use an automation to turn up the temperatre

I see your logic. I’ll set the basement temp to a comfortable number. When the first floor is set to heat and the basement room temp is the same or above the set temp it wont heat the basement. I ended up using the modified original code, which works just fine.

#Thermostat Automation - Turn on basement if first floor turns on
- alias: Set basement thermostat
  trigger:
    platform: state
    entity_id: climate.first_floor_heat
  action:
    service: climate.set_hvac_mode
    entity_id: climate.basement_heat
    data_template:
     operation_mode: >
          {% if is_state('climate.first_floor_heat', 'heat') %}
            heat
          {% else %}
            off
          {% endif %}

The code with hvac_mode: “{{ trigger.to_state.state }}” doesn’t work. It doesn’t trigger the basement thermostat.

Which version of Home Assistant are you using?

Climate integrations underwent a major change a few versions ago and no longer support operation_mode (replaced with hvac_mode). If operation_mode works for you, then you’re not using a recent version (and when you upgrade, you’ll need to modify your automation otherwise it will fail).

I am using v0.100.3. I updated my code with hvac_mode, which works, but the code you wrote up doesn’t work.

#Thermostat Automation - Turn on basement if first floor turns on
- alias: Set basement thermostat
  trigger:
  - platform: state
    entity_id: climate.first_floor_heat
    to: 'heat'
  - platform: state
    entity_id: climate.first_floor_heat
    to: 'off'
  action:
    service: climate.set_hvac_mode
    entity_id: climate.basement_heat
    data_template:
      hvac_mode: "{{ trigger.to_state.state }}"

Redacted.

EDIT
OK, so a copy-paste error was the culprit. Glad to hear my example works for you.

Actually I stand corrected. Your code does work. I copied it wrong the first time. I apologize. It’s definitely better than my code.

In my prviouse post I pasted the wrong version of the code. My apologies again. I am a mess today. This is the code that works. Both your code an my modified code with hvac_mode work, but your code is much cleaner and shorter.

#Thermostat Automation - Turn on basement if first floor turns on
- alias: Set basement thermostat
  trigger:
  - platform: state
    entity_id: climate.first_floor_heat
    to: 'heat'
  - platform: state
    entity_id: climate.first_floor_heat
    to: 'off'
  action:
    service: climate.set_hvac_mode
    entity_id: climate.basement_heat
    data_template:
      hvac_mode: "{{ trigger.to_state.state }}"

Whew! This thread is getting confusing because what you posted above isn’t my example.

Whatever you’re using, I hope it serves you well.

Good luck!