Automation for a variable thermostat target temperature

Hi!

I’m trying to think through how to setup an automation that will automatically change the thermostat target cooling temperature based on the outdoor temperature. I want my target temperature to be equal to 20 degrees cooler than the outdoor temperature if it’s above 95F degrees outside (95F or below, I’d like it set at a static 75F degrees target). I have a sensor to grab the outdoor temperature, but I’m not sure how to implement the automation with it? Any help/suggestions or ideas are welcome!

Thanks!
-Chad

My thermostat automation:

# Main Floor Thermostat Automation
- alias: "Set Main Floor Thermostat Cool Target"
  initial_state: True
  hide_entity: true
  trigger:
    platform: state
    entity_id: input_slider.main_thermostat_cool_target
  action:
    service: mqtt.publish
    data_template:
      topic: "smartthings/Main Floor Thermostat/coolingSetpoint"
      retain: true
      payload: '{{ states.input_slider.main_thermostat_cool_target.state }}'

My sensors in thermostat.yaml:

- platform: mqtt
  name: "Main Floor Thermostat State"
  state_topic: "smartthings/Main Floor Thermostat/thermostatOperatingState"
  retain: true

- platform: mqtt
  name: "Main Floor Thermostat Heat Target"
  state_topic: "smartthings/Main Floor Thermostat/heatingSetpoint"
  unit_of_measurement: '°F'
  retain: true

- platform: mqtt
  name: "Main Floor Thermostat Cool Target"
  state_topic: "smartthings/Main Floor Thermostat/coolingSetpoint"
  unit_of_measurement: '°F'
  retain: true

- platform: mqtt
  name: "Main Floor Thermostat Mode"
  state_topic: "smartthings/Main Floor Thermostat/thermostatMode"
  retain: true

- platform: mqtt
  name: "Main Floor Thermostat Humidity"
  state_topic: "smartthings/Main Floor Thermostat/humidity"
  retain: true

Hi, I would suggest creating an input_slider to hold the target temp value. Every time the outdoor temp is updated, it will run the following automation and set that value for input_slider.target temp:

- alias: set_target_temp
  trigger:
    - platform: state
      entity_id: sensor.outdoor_temp
  action:
    - service: input_slider.select_value
      data_template:
        entity_id: input_slider.target_temp
        value: >
        {% if trigger.state | int < 95 %}
          75
        {% else %}
          {{ trigger.state | int - 20 }}
        {% endif %}

Then point your thermostat to use the value in ‘{{ states.input_slider.target_temp.state }}’

1 Like

Thank you!! I’ll give that a shot!

-Chad