How to get state attributes (lambda)?

I am trying to get the state attribute “temperature” of the climate in ESPHome.
Sadly I’m unable to find any information about how to do this.
I’ve tried different things like

  • .state.attributes.temperature
  • .state.attribute.temperature
  • .attributes.temperature
  • .temperature

but none of them seem to work.
Always getting error: 'class esphome::thermostat::ThermostatClimate' has no member named 'xxx'

binary_sensor:
  - platform: template
    name: ${device_prefix} Zieltemperatur erreicht
    lambda: |-
      if (id(water_temp).state >= id(heater_climate).temperature) { # <- get the "temperature" attribute
        return true;
      } else {
        return false;
      }

The climate:

climate:
  - platform: thermostat
    id: heater_climate
...

Doesn’t look like it has a temperature attribute, just a current_temperature and a target_temperature.

1 Like

Thank you, I guess I have looked at the wrong places :slight_smile:
The target temperature is actually what I want to get. I thought it would be the same as in Home Assistant where it is just named temperature but apparently it is not.