Target temperature adjustment depending on second temperature sensor

Thank you @nevesenin! Exactly what I was looking for. With your updates, I can now create a dummy thermostat for the control of the set value and use it in the UI without confusing the rest of the family…

@nevesenin @roasted Thank you both for the hard work on this. Just moved into a new place where the thermostat is being cooked during the day so setting the target temp based on a different sensor is really helping. One issue I am having is when the automation is running the thermostat does not turn off. Even after the target temperature is reached and the thermostat is set to a higher temperature it keeps cooling without stopping. If I turn off the automation and manually set the thermostat temperature to a higher value it will turn off right away. Anything you can think of that may be causing this issue? I am using a Honeywell T6 Pro. Others on this have mentioned using that model as well so I am not sure if it is something I am doing wrong. I copied the code exactly from @roasted latest example on this post and did not change it. Thank you again for the help!

This is ALMOST what I am trying to do but not quite… I am wanting to set the target temperature on my thermostat in HA based on the temperature outside. If it is 94F or less outside then I want the target to be 74F. If it is more than 94F outside then I want the target to be the outside temp minus 20F. When I put this in the template engine, it works fine but that’s where my skills stop. I can’t figure out how to send this to the climate.set_temperature on the thermostat.
Here is my template code:

{% if state_attr('weather.home','temperature') > 94 %}
{{state_attr('weather.home','temperature') - 20}}
{% elif state_attr('weather.home','temperature') <= 94 %}
74
{% endif %}

Can anyone give me any ideas on how to send the output of the template to the set_temperature attribute of the thermostat?

I tried it in NodeRed also but the msg.data output of the function node is undefined.
Here is that code:

outside_temp = msg.data.attributes.temperature;
if (outside_temp > 94)
setpoint_temp = outside_temp - 20;

if (outside_temp <= 94)
setpoint_temp = 74;
{
     msg.data = '{"temperature":' + setpoint_temp + '}';
}
return msg;

Any help would be MUCH appreciated.

I finally figured it out. Here is what I ended up doing to make it work:

outside_temp = msg.data.attributes.temperature;

if (outside_temp > 94)
setpoint_temp = outside_temp - 20;

else

setpoint_temp = 74;

msg.payload = {
    data: {
        temperature: + setpoint_temp
    }
};

return msg;

Hi I’m new to using blueprints, but from what I have read in this thread it sounds like this might be the blueprint I’m looking for. Can someone either paste a link to the Fahrenheit version of the blueprint (or the actual code i guess would work too) so I can try this one out and see if its the automation that I have been wanting to make? (I just want to make sure I’m using the newest one that is known to work.

Hi! The latest version can be found here: empunkt/homeassistant-blueprints: Collection of homeassistant blueprints I created - homeassistant-blueprints - Codeberg.org. Unfortunately it is still Celsius only.

This is the one I have been using for fahrenheit

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

But it has been a bit since I last checked the forum to see if it’s been updated.

See roasted’s post above for info on setting it up.

1 Like

Hey all!

I was trying to make this work with my thermostat (honeywell T6 pro z-wave) and was trying to make it work for the Heat/Cool option. I grabbed the Fahrenheit version of this blueprint and modified it to allow for two setpoints (target_temp_high and target_temp_low). I created two input numbers, one for the high value and one for the low. The rest is pretty much copied from the original blueprint.

I’ve only been running it for about a day, and no issues so far. I am still fairly new at this, so feel free to criticize

alias: HVAC Heat_Cool
description: >-
  Uses input_number.hvac_target_upper_temp and 
  input_number.hvac_target_lower_temp to change climate.kitchen setpoints in
  Heat/Cool mode
trigger:
  - platform: state
    entity_id: climate.t6_pro_thermostat
    attribute: '{{ current_temperature_attribute }}'
  - platform: state
    entity_id: sensor.thermal_comfort_heat_index
  - platform: state
    entity_id:
      - input_number.hvac_target_lower_temp
      - input_number.hvac_target_upper_temp
condition:
  - '{{ calculated_adjustment_heat != 0 }}'
  - '{{ calculated_adjustment_cool != 0 }}'
action:
  - service: system_log.write
    data:
      message: >
        {{ thermostat }} has temp difference of {{ calculated_adjustment_heat,
        calculated_adjustment_cool }}. Setting target temperature to {{
        calculated_target_temperature_heat, calculated_target_temperature_cool
        }}
      level: info
      logger: homeassisstant.components.automation.hvac_heat_cool
    enabled: true
  - service: system_log.write
    data:
      message: >
        thermostat: {{ thermostat }}, temperature_sensor: {{ temperature_sensor
        }}, target_temperature: {{ states(target_temperature_heat) | float |
        round(1)}}, actual_temperature: {{ actual_temperature }},
        calculated_adjustment_heat: {{ calculated_adjustment_heat }},
        calculated_target_temperature_heat: {{
        calculated_target_temperature_heat }}

        thermostat: {{ thermostat }}, temperature_sensor: {{ temperature_sensor
        }}, target_temperature: {{ states(target_temperature_cool) | float |
        round(1)}}, actual_temperature: {{ actual_temperature }},
        calculated_adjustment_cool: {{ calculated_adjustment_cool }},
        calculated_target_temperature_cool: {{
        calculated_target_temperature_cool }}
      level: debug
      logger: homeassisstant.components.automation.hvac_heat_cool
    enabled: true
  - service: climate.set_temperature
    data:
      target_temp_high: '{{ calculated_target_temperature_cool }}'
      target_temp_low: '{{ calculated_target_temperature_heat }}'
    target:
      entity_id: climate.t6_pro_thermostat
    enabled: true
variables:
  thermostat: climate.t6_pro_thermostat
  temperature_sensor: sensor.thermal_comfort_heat_index
  actual_temperature: '{{ states(temperature_sensor) | float }}'
  target_temperature_heat: input_number.hvac_target_lower_temp
  calculated_adjustment_heat: '{{ states(target_temperature_heat) | float - actual_temperature }}'
  calculated_target_temperature_heat: >-
    {{ ( ( ( states(target_temperature_heat) | float +
    calculated_adjustment_heat ) * 2 ) | round ) / 2 }}
  target_temperature_cool: input_number.hvac_target_upper_temp
  calculated_adjustment_cool: '{{ states(target_temperature_cool) | float - actual_temperature }}'
  calculated_target_temperature_cool: >-
    {{ ( ( ( states(target_temperature_cool) | float +
    calculated_adjustment_cool ) * 2 ) | round ) / 2 }}
mode: single

Hi,

that’s pretty much what I’m looking for. Unfortunately, I have no experience with Yaml or programming, so my question would be whether you could enter an entity such as a scheduler instead of the target temperature. The background is that my target temperatures are controlled via the scheduler integration and these change over the course of the day. I would do it myself, but as I mentioned, I wouldn’t know how to start. I would be happy to receive feedback.