AC control is working using ESPHome and thermostat on dashboard, but how to automate?

This is a bit of a noob question I’m afraid…

I can control my AC’s through the Home Assistant dashboard thermostat, this is working. I would now like to automate this. I have been reading on this forum and also the automation instruction on the ESPHome website. It is still unclear to me what the best practice is to achieve my goal:

I would like to have a target temperature range. When it is colder my AC will heat, when it is hotter my AC will cool. This based on a schedule of certain days and times when I want it to be active.

What are the advised steps to achieve the above? I am a beginner.

Edt: as requested the ESPHome Yaml are below.

Haier AC

esphome:
  name: d1-mini-haier-1

esp8266:
  board: d1_mini

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "d1-mini-haier-1 Fallback Hotspot"
    password: "Su3Ji6nDEPBg"

# external_components:
#  - source: github://esphome/esphome@dev
#    components: [ haier ]

external_components:
  - source: github://paveldn/haier-esphome@dev
    components: [ haier ]

api:
  encryption:
    key: "redacted"

ota:
  password: "redacted"

uart:
  - id: ac_port
    baud_rate: 9600
# Use real pins for your device
    tx_pin: 1
    rx_pin: 3

logger:
  level: DEBUG
  hardware_uart: UART1

climate:
  - platform: haier
    id: haier_climate
# If hOn protocol will not work try smartAir2
    protocol: hOn
    name: Haier AC
    uart_id: ac_port
    beeper: false
    display: false

Midea AC

esphome:
  name: d1-mini-midea
  platform: ESP8266
  board: d1_mini

# Enable Home Assistant API
api:
  encryption:
    key: "redacted"

ota:
  password: "redacted"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "D1-Mini-Midea Fallback Hotspot"
    password: "tfnpxtiOZjnb"

# Example configuration entry

# Disable logging over UART (required)
logger:
  baud_rate: 0

# UART settings for Midea dongle (required)
# Pinout is bewust andersom ten opzichte van Haier anders werkt het niet
uart:
  tx_pin: 3         # hardware dependant
  rx_pin: 1         # hardware dependant
  baud_rate: 9600

# Main settings
climate:
  - platform: midea
    name: Midea Climate         # Use a unique name.
    period: 1s                  # Optional
    timeout: 2s                 # Optional
    num_attempts: 3             # Optional
    autoconf: true              # Autoconfigure most options.
    beeper: false                # Beep on commands.
    visual:                     # Optional. Example of visual settings override.
      min_temperature: 17 °C    # min: 17
      max_temperature: 30 °C    # max: 30
      temperature_step: 0.5 °C  # min: 0.5
    supported_modes:            # Optional. All capabilities in this section may be detected by autoconf.
      - FAN_ONLY
      - HEAT_COOL
      - COOL
      - HEAT
      - DRY
    custom_fan_modes:           # Optional
      - SILENT
      - TURBO
    supported_presets:          # Optional. All capabilities in this section may be detected by autoconf.
      - ECO
      - BOOST
      - SLEEP
    custom_presets:             # Optional. All capabilities in this section may be detected by autoconf.
      - FREEZE_PROTECTION
    supported_swing_modes:      # Optional
      - VERTICAL
      - HORIZONTAL
      - BOTH
    outdoor_temperature:        # Optional. Outdoor temperature sensor (may display incorrect values after long inactivity).
      name: Temp
    power_usage:                # Optional. Power usage sensor (only for devices that support this feature).
      name: Power
    humidity_setpoint:          # Optional. Indoor humidity sensor (only for devices that support this feature).
      name: Humidity

Hi and welcome. It would be good if you edit your post to include your YAML. That way we can see how you have configured your thermostat and climate entity on the ESP.

Don’t forget to format your code correctly with Preformatted text tags, please read this before posting:

I have added the yaml for both AC’s, thanks for the heads up!