Read climate card data from ESPHome

Hello,
I have one ESPHome node with LCD and rotary encoder also there is a simple thermostat card on HA’s dashboard which is uses climate platform. I want to get “set temperature” value from this card to the ESP and display on the LCD so i can set the temparature with rotary encoder. I can read the room temperature from Dallas 18B20 sensor and print on LCD because it’s connected to ESP directly and temperature data being created inside ESP. But i dont know how to get card data from dashboard.

Thanks in advance…

You can get the set temperature attribute from the climate entity with this:

1 Like

Ok, thank you for your life saving help :slight_smile:

Now i have an another problem. I am getting current_temperature from the climate card but target_temperature showing itself as NAN. Here is my codes. Any idea? And one last thing; do you see any problem with my rotary encoder codes? I am not getting any response. Connections are correct because i tested with Rotary Encoder Example sketch in Arduino IDE but in ESPHome rotary encoder doesn’t work.

Thanks in advance…

esphome:
  name: thermostatoda

esp8266:
  board: esp01_1m

# Enable logging
logger:

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

ota:
  password: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

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:
    - logger.log: "Turned Clockwise"
    on_anticlockwise:
    - 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

spi:
  clk_pin: 14
  mosi_pin: 13

font:
  - file: "gfonts://Bebas Neue"
    id: font_1
    size: 20
    
display:
  - platform: st7920
    update_interval: 5s
    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);
    cs_pin:
      number: 15
      inverted: true
    width: 128
    height: 64

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