Getting climate control's target temparature

Hello everyone,

I have a problem about getting the climate control’s “target temperature”. I am getting current_temperature from the climate card but target_temperature showing itself as NAN. Here is my codes.

esphome:
  name: thermostatoda

esp8266:
  board: esp01_1m

# Enable logging
logger:

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

ota:
  password: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Thermostatoda Fallback Hotspot"
    password: "Ic9G710Rbkh4"

captive_portal:
  
  # Example configuration entry
dallas:
  - pin: 4

# Individual sensors
sensor:
  - platform: dallas
    index: 0
    id: oda_sicakligi
    name: "Livingroom Temperature"

  - platform: rotary_encoder
    name: "Rotary Encoder"
    id: thermo_encoder
    pin_a:
      number: 2
      inverted: true
      mode: INPUT_PULLUP
    pin_b: 
      number: 12
      inverted: true
      mode: INPUT_PULLUP
    filters:
      - or:
        - debounce: 0.1s
        - delta: 10
    min_value: 5
    max_value: 30
    resolution: 2
    on_clockwise:
    - switch.turn_on: switch_lcdbacklight
    - logger.log: "Turned Clockwise"
    on_anticlockwise:
    - switch.turn_on: switch_lcdbacklight
    - logger.log: "Turned Anticlockwise"

  - platform: homeassistant
    id: current_temp
    entity_id: climate.kombi_thermostat
    attribute: current_temperature

  - platform: homeassistant
    id: target_temp
    entity_id: climate.kombi_thermostat
    attribute: target_temperature

output:
  - platform: gpio
    pin: 16
    id: lcdbacklight

switch:
  - platform: output
    name: "LCD LED"
    output: lcdbacklight
    id: switch_lcdbacklight
    on_turn_on:
    - delay: 5s
    - switch.turn_off: switch_lcdbacklight

binary_sensor:
  - platform: gpio
    pin:
      number: 5
      mode: INPUT_PULLUP
      inverted: false
    id: rotary_button
    name: "Rotary Button"
    filters:
      - delayed_on: 10ms
    on_press:
      then:
        - switch.turn_on: switch_lcdbacklight
        - logger.log: "Button pressed"

spi:
  clk_pin: 14
  mosi_pin: 13

font:
  - file: "gfonts://Bebas Neue"
    id: font_1
    size: 20
    
display:
  - platform: st7920
    update_interval: 1s
    cs_pin:
      number: 15
      inverted: true
    width: 128
    height: 64
    lambda: |-
      it.image(4, 14, id(Home));
      it.image(7, 40, id(Thermometer));
      it.rectangle(0, 0, 127, 63);
      it.printf(22, 13, id(font_1), "%.1f°", id(current_temp).state);
      it.printf(22, 37, id(font_1), "%.1f°", id(target_temp).state);

image:
  - file: "images/Home_16x17.png"
    id: Home
  - file: "images/Thermometer2_16x17.png"
    id: Thermometer

Thanks in advance…

The attribute you want is temperature not target_temperature.

1 Like

The description on this page (Climate Component — ESPHome) states it as target_temperature, but actually it is just temperature as you said. I’ve been dealing with this for two days. Thank you so much. :pray:

Yes, but that is when setting up a esphome native climate component. You are importing a climate component from HA which uses temperature. If you need to see what attributes an entity has, look in developer tools.

1 Like

Thank you for your advice…