Adjusting Thermostat per Temperature Range

I currently have an automation that adjusts my thermostat based on the outside temp, and it lowers the temp by 7 degrees once the conditions are met. I’ve found that it’s a bit too aggressive. I have found a much better setup that I want, but I’m just drawing blanks on how to proceed. I think I’m needing an IF statement or multiple automations, I would prefer an IF statement, so I only have to manage one automation. I don’t know how to make them, so that’s not helping me.

What I’m wanting to do for the conditions are that when the outside temp reaches a temp within range of 75-80 then set the thermostat to 75, if not in sleep or away modes. I also haven’t been able to figure how to setup the range as a condition. I am wanting the conditions to be:

Outside Temperature Range Thermostat Cool Setting
< 74 Resume Program
75 - 80 75
81 - 85 76
86 - 90 77
91 - 95 78
> 96 79

I’m using an Ecobee thermostat and I’m also using the outside weather from the Ecobee.

Can anybody assist with either making an IF statement or a single automation that can accommodate this? I will post what I’ve tried to create in a reply below.

Below is the automation that I had assistance with creating:

- id: '1'
  alias: It's Getting Warm Out There
  description: Sets the air appropriately when it's 82 or more outside.
  trigger:
  - platform: state
    entity_id: weather.home
  condition:
  - condition: template
    value_template: "{{ trigger.to_state.attributes.temperature >= 82 and\n   state_attr('climate.home',\
      \ 'preset_mode') not in ['away', 'sleep'] }}\n"
  action:
  - service: climate.set_temperature
    entity_id: climate.home
    data_template:
      hvac_mode: heat_cool
      target_temp_high: '{{ trigger.to_state.attributes.temperature - 7 }}'
      target_temp_low: 69
  - service: climate.set_fan_mode
    entity_id: climate.home
    data:
      fan_mode: 'on'

Below is what I tried to create based off the previous example:

- id: '2'
  alias: It's Getting Warm Out There (test)
  description: Sets the air appropriately when it's 82 or more outside.
  trigger:
  - entity_id: weather.home
    platform: state
  condition:
  - condition: template
    value_template: "{{ trigger.to_state.attributes.temperature [70,trigger.to_state.attributes.temperature,90]\
      \ and\n   state_attr('climate.home', 'preset_mode') not in ['away', 'sleep']\
      \ }}\n"
  - condition: or
    conditions:
    - above: '74'
      below: '81'
      condition: numeric_state
      entity_id: weather.home
      value_template: trigger.to_state.attributes.temperature
  action:
  - data_template:
      hvac_mode: heat_cool
      target_temp_high: 75
      target_temp_low: 69
    entity_id: climate.home
    service: climate.set_temperature
  - data:
      fan_mode: 'on'
    entity_id: climate.home
    service: climate.set_fan_mode
  mode: single

I added an OR condition in hopes that there was another way to make this work.

My Ecobee’s friendly name is: home

Here are the attributes for climate.home: (Thermostat settings)

hvac_modes:
  - heat_cool
  - heat
  - cool
  - 'off'
min_temp: 45
max_temp: 95
fan_modes:
  - auto
  - 'on'
preset_modes:
  - Home
  - Away
  - Sleep
current_temperature: 73
temperature: null
target_temp_high: 72
target_temp_low: 67
current_humidity: 52
fan_mode: 'on'
hvac_action: cooling
preset_mode: Sleep
aux_heat: 'off'
fan: 'on'
climate_mode: Sleep
equipment_running: 'compCool1,fan'
fan_min_on_time: 0
friendly_name: Home
supported_features: 91

Here are the attributes for the weather function of the thermostat:

I’m only using the temperature of the other options.

temperature: 72
humidity: 90
pressure: 1015
wind_bearing: 289
wind_speed: 6
visibility: 15
attribution: 'Ecobee weather provided by FI:KFWA at 2020-08-18 03:04:41 UTC'
forecast:
  - datetime: '2020-08-18T00:00:00'
    condition: sunny
    temperature: 79
    templow: 57
    wind_bearing: 12
    wind_speed: 6
  - datetime: '2020-08-19T00:00:00'
    condition: sunny
    temperature: 79
    templow: 54
    wind_bearing: 42
    wind_speed: 5
  - datetime: '2020-08-20T00:00:00'
    condition: sunny
    temperature: 82
    templow: 53
    wind_bearing: 84
    wind_speed: 4
  - datetime: '2020-08-21T00:00:00'
    condition: sunny
    temperature: 86
    templow: 56
    wind_bearing: 142
    wind_speed: 2
friendly_name: Home

Hey man did you ever solve the issues with the automation. I too would like to setup my automation to run a similar sequence of based on forecast temperatures.

Unfortunately I have not. I don’t quite understand the programming language needed for the template. I know the logic will most likely be an IF Else statement, but I’m lost on what to do next.