How do I read thermostat current_temperature state in automation

I am trying to create an automation that reads the temperature from a sensor in a bedroom at 9:30 PM and then if the temperature is below a certain point, set the thermostat (out in the hallway) to 1 degrees higher than the current_temperature state reported by the thermostat. I have looked through the documentation and various examples, but I cannot find a way to read in the current_temperature state from a thermostat in an automation. Does anyone have any idea to get this to work?

alias: Increase Temperature - Master Bedroom
description: ''
trigger:
  - platform: time
    at: '21:30:00'
condition:
  - condition: state
    entity_id: sensor.master_bedroom_temperature
    state: 'below: 66'
action:
  - service: climate.set_temperature
    data:
      entity_id: climate.2nd_floor
      temperature: '{{ float(state.current_temperature) + 1 }}'
      hvac_mode: heat
mode: single
1 Like

Like this:

      temperature: "{{ state_attr('climate.2nd_floor', 'current_temperature') + 1 }}"

The relevant section of the documentation is here: Templating - States

BTW, unless the value of the master bedroom sensor is literally the phrase “below: 66” your State Condition will always fail.

Perhaps what you want is a Numeric State Condition?

condition:
  - condition: numeric_state
    entity_id: sensor.master_bedroom_temperature
    below: 66
1 Like

Thanks! I was looking for information about how to query states, but my search was probably too narrow by looking at the climate domain. Thanks for the tip about the numeric_state condition too.

I’ll know at 9:30 PM tonight if it all works correctly. :slight_smile:

Did it work?

Yes, it worked perfectly. I had to increase the trigger temp to test because it has warmed up a bit, but this week is cooler and rainy, so it will be nice to have this working.

Thanks again for your help. It is the community that makes Home Assistant such a great product.

Glad to hear it’s working.

Please consider marking my first post with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has a accepted solution. This helps users find answers to similar questions.

I want to archive something.

When i open my windows and/or doors i want the set temperature from the heater to be written to a helper. And when my doors and windows are closed to continue to set my heater at that set temperature that was there before opening and closing the temperature.

is it possible to write the temperature to a helper and then use it afterwards?