Thermostat Temperature Always Set to 23 Degrees?

I have been a user of the thermostat function for a long time… but this really has me stumped. See the code below. No matter what temperature I set the default_target_temperature_high at it always shows as being set to 23 degrees?

esphome:
  name: esp-a2-studio-climate
  platform: esp32
  board: esp32dev
  on_boot:
  - delay: 2s
  - climate.control:
      id: daikin_ac
      mode: 'off'
  - logger.log: "Telling Air Conditioner to STOP"
  - mqtt.publish:
      topic: test_HomeAssistant/Studio/Aircon/Status
      payload: "OFF"

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: <redacted>

ota:
  platform: esphome
  password: <redacted>

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0

# Optional manual IP
  manual_ip:
    static_ip: <redacted>
    gateway: <redacted>
    subnet: 255.255.255.0

# MQTT Interface
mqtt:
  broker: !secret mqtt_broker
  username: !secret mqtt_login
  password: !secret mqtt_passwd
  port: 1883
  reboot_timeout: 0s
  keepalive: 60s
  discovery: false

i2c:
- id: bus_a
  sda: 4
  scl: 16
  scan: true

# Dallas 1-wire sensors
one_wire:
  - platform: gpio
    pin: 33

# IR TRansmitter entry
remote_transmitter:
  pin:
    number: 14
  id: infrared_transmit
  carrier_duty_percent: 50%

sensor:
  - platform: dallas_temp
    address: 0x1046e67f1f64ff28
    name: "Studio Inside Temp"
    id: a2_in_temp_studio
    resolution: 12
    update_interval: 30s
      
  - platform: dallas_temp
    name: "Studio Outside Temp"
    id: a2_out_temp_studio
    resolution: 12
    address: 0x120120500dc9ab28
    update_interval: 30s
    filters:
    - sliding_window_moving_average:
        window_size: 10
        send_every: 5

#Relay switches
switch:
  - platform: template
    id: do_cooling
    optimistic: true
  - platform: gpio
    pin: 
      number: 15
      ignore_strapping_warning: true
      inverted: false
    id: studio_damper_rly
    name: "Studio Damper Relay"
    restore_mode: RESTORE_DEFAULT_OFF
  - platform: gpio
    pin: 
      number: 2
      ignore_strapping_warning: true
      inverted: false
    id: studio_fan_rly
    name: "Studio Fan Relay"
    restore_mode: RESTORE_DEFAULT_OFF

binary_sensor:
  - platform: template
    id: damper
    lambda: return (id(a2_out_temp_studio).state < 18) && (id(a2_in_temp_studio).state <= 24);
    on_press:
      - logger.log: "Telling Damper to OPEN"
      - switch.turn_on: studio_damper_rly
      - mqtt.publish:
          topic: HomeAssistant/Studio/Damper/Status
          payload: "OPEN"
    on_release:
      - logger.log: "Telling Damper to CLOSE"
      - switch.turn_off: studio_damper_rly
      - mqtt.publish:
          topic: HomeAssistant/Studio/Damper/Status
          payload: "CLOSED"
  - platform: copy
    id: damper_open
    source_id: damper
    filters:
      - delayed_on: 4sec
  - platform: template
    id: fan
    lambda: return id(do_cooling).state && id(damper_open).state;
    on_press:
      - logger.log: "Telling Fan to START"
      - switch.turn_on: studio_fan_rly
      - mqtt.publish:
          topic: HomeAssistant/Studio/Fan/Status
          payload: "OFF"
    on_release:
      - logger.log: "Telling Fan to STOP"
      - switch.turn_off: studio_fan_rly
      - mqtt.publish:
          topic: HomeAssistant/Studio/Fan/Status
          payload: "OFF"
  - platform: template
    id: ac
    lambda: "return (id(do_cooling).state && !id(damper).state);"
    on_press:
      - logger.log: "Telling Air Conditioner to START"
      - mqtt.publish:
          topic: HomeAssistant/Studio/Aircon/Status
          payload: "ON"
      - climate.control:
          id: daikin_ac
          mode: 'cool'
          fan_mode: AUTO
          target_temperature: 22 °C
      - binary_sensor.template.publish:
          id: studio_ac_status
          state: "ON"
    on_release:
      - logger.log: "Telling Air Conditioner to STOP"
      - mqtt.publish:
          topic: HomeAssistant/Studio/Aircon/Status
          payload: "OFF"      
      - climate.control:
          id: daikin_ac
          mode: 'off'
      - binary_sensor.template.publish:
          id: studio_ac_status
          state: "OFF"
  - platform: template
    name: "Studio Aircon"
    id: studio_ac_status

# Studio Climate Control
climate:
  - platform: daikin
    name: "Daikin Aircon"
    id: daikin_ac
    supports_heat: false
    transmitter_id: infrared_transmit

  - platform: thermostat
    name: "Fan Climate Control"
    sensor: a2_in_temp_studio
    min_cooling_off_time: 300s
    min_cooling_run_time: 300s
    min_idle_time: 30s
    id: fan_climate_control
    cool_action:
      - switch.turn_on: do_cooling
      - logger.log: "The studio fan is ON"
    idle_action:
      - switch.turn_off: do_cooling
      - logger.log: "The studio fan is OFF"
    default_preset: Studio
    preset:
      - name: Studio
        default_target_temperature_high: 22 °C

As you can see from the logs below… the line…

[21:59:01][C][thermostat.climate:974]:       Studio Default Target Temperature High: 22.0°C

Makes it appear the temperature is set correctly.

[21:59:01][C][thermostat.climate:1290]: Thermostat 'Fan Climate Control'
[21:59:01][C][thermostat.climate:1295]:   Start-up Delay Enabled: NO
[21:59:01][C][thermostat.climate:1297]:   Cooling Parameters:
[21:59:01][C][thermostat.climate:1298]:     Deadband: 0.5°C
[21:59:01][C][thermostat.climate:1299]:     Overrun: 0.5°C
[21:59:01][C][thermostat.climate:1306]:     Minimum Off Time: 300s
[21:59:01][C][thermostat.climate:1308]:     Minimum Run Time: 300s
[21:59:01][C][thermostat.climate:1337]:   Minimum Idle Time: 30s
[21:59:01][C][thermostat.climate:1338]:   Supports AUTO: NO
[21:59:01][C][thermostat.climate:1339]:   Supports HEAT/COOL: NO
[21:59:01][C][thermostat.climate:1340]:   Supports COOL: YES
[21:59:01][C][thermostat.climate:1341]:   Supports DRY: NO
[21:59:01][C][thermostat.climate:1342]:   Supports FAN_ONLY: NO
[21:59:01][C][thermostat.climate:1344]:   Supports FAN_ONLY_ACTION_USES_FAN_MODE_TIMER: NO
[21:59:01][C][thermostat.climate:1345]:   Supports FAN_ONLY_COOLING: NO
[21:59:01][C][thermostat.climate:1347]:   Supports FAN_WITH_COOLING: NO
[21:59:01][C][thermostat.climate:1352]:   Supports HEAT: NO
[21:59:01][C][thermostat.climate:1353]:   Supports FAN MODE ON: NO
[21:59:01][C][thermostat.climate:1354]:   Supports FAN MODE OFF: NO
[21:59:01][C][thermostat.climate:1355]:   Supports FAN MODE AUTO: NO
[21:59:01][C][thermostat.climate:1356]:   Supports FAN MODE LOW: NO
[21:59:01][C][thermostat.climate:1357]:   Supports FAN MODE MEDIUM: NO
[21:59:01][C][thermostat.climate:1358]:   Supports FAN MODE HIGH: NO
[21:59:01][C][thermostat.climate:1359]:   Supports FAN MODE MIDDLE: NO
[21:59:01][C][thermostat.climate:1360]:   Supports FAN MODE FOCUS: NO
[21:59:01][C][thermostat.climate:1361]:   Supports FAN MODE DIFFUSE: NO
[21:59:01][C][thermostat.climate:1362]:   Supports FAN MODE QUIET: NO
[21:59:01][C][thermostat.climate:1363]:   Supports SWING MODE BOTH: NO
[21:59:01][C][thermostat.climate:1364]:   Supports SWING MODE OFF: NO
[21:59:01][C][thermostat.climate:1365]:   Supports SWING MODE HORIZONTAL: NO
[21:59:01][C][thermostat.climate:1366]:   Supports SWING MODE VERTICAL: NO
[21:59:01][C][thermostat.climate:1367]:   Supports TWO SET POINTS: NO
[21:59:01][C][thermostat.climate:1369]:   Supported PRESETS: 
[21:59:01][C][thermostat.climate:1377]:   Supported CUSTOM PRESETS: 
[21:59:01][C][thermostat.climate:1381]:     Supports Studio: YES
[21:59:01][C][thermostat.climate:959]:       Studio Is Default: YES
[21:59:01][C][thermostat.climate:974]:       Studio Default Target Temperature High: 22.0°C

But look at this entry below… it is stuck at 23 degrees for some reason?

[21:59:17][D][climate:396]: 'Fan Climate Control' - Sending state:
[21:59:17][D][climate:399]:   Mode: COOL
[21:59:17][D][climate:401]:   Action: IDLE
[21:59:17][D][climate:419]:   Current Temperature: 23.44°C
[21:59:17][D][climate:425]:   Target Temperature: 23.00°C

I have tried everything… even adjusting the default_target_temperature_high to 19 degrees… but the logs (see above) always list the Target Temperature High is always 23 degrees?

Open to ideas, because I am completely stumped?

So after some testing things are getting interesting… If I change the yaml for the thermostat to below:-

  - platform: thermostat
    name: "Thermostat Climate Controller"
    sensor: a2_in_temp_studio
    min_cooling_off_time: 300s
    min_cooling_run_time: 300s
    min_idle_time: 30s
    cool_action:
      - switch.turn_on: do_cooling
    idle_action:
      - switch.turn_off: do_cooling
    default_preset: Home
    preset:
      - name: Home
        default_target_temperature_high: 22 °C

I see the following in the logs:-

[17:07:00][D][climate:396]: 'Thermostat Climate Controller' - Sending state:
[17:07:00][D][climate:399]:   Mode: OFF
[17:07:00][D][climate:401]:   Action: OFF
[17:07:00][D][climate:410]:   Preset: HOME
[17:07:00][D][climate:419]:   Current Temperature: 23.31°C
[17:07:00][D][climate:425]:   Target Temperature: 22.00°C

The Target Temperature looks good! But the Mode: being OFF is an issue as the fan never triggers.

Now I need to workout how I change the Mode from OFF to COOL??

Thanks to @jesserockz on reddit, apparently I need to ‘change to the preset’… which I take to mean “tell the thermostat to use the preset” which makes sense.

Here’s some code I found, but I have no clue where to include it in my yaml?

- climate.control:
  id: your_climate_id
  preset: your_preset_name

Ideally if I could do this without presets I probably would… I only need to set the one temperature.

Solved! Ended up adding a version of the code above to the boot routine, see below:-

on_boot:
  - delay: 2s
  - climate.control:
      id: fan_climate_control
      target_temperature: 22 °C

Which basically tells the climate for the fan to run at 22 degrees.

I’ve learnt something new… And it works :grinning: