Remembering the temperature of thermostat

HI,

Made an automation - when I open the window (have door/window sensor) my thermostat turns off. When i close the window it turns to the declared temperature of 21. Can the HA remember the temperature from before opening the window and set it when I close ? Right now my automation looks like this:

  • alias: Beedroon_off
    trigger:
    platform: state
    entity_id: binary_sensor.sensor
    to: ‘on’
    action:

    • service: climate.set_temperature
      entity_id: climate.bedroom_termostat_1
      data:
      temperature: ‘4.5’ ## 4,5 is off
  • alias: Bedroom_komfort
    trigger:
    platform: state
    entity_id: binary_sensor.sensor
    to: ‘off’
    action:
    service: climate.set_temperature
    entity_id: climate.bedroom_termostat_1
    data:
    temperature: 21

1 Like

Is there maybe another way to turn the heater off so that the thermostat keeps the set temperature?

Mine has the states ‘off’ and ‘heat’ so I would not change the temperature, I would just change the state of the climate component.

1 Like

Like chairstacker said, some thermostats have feature to set operation to heat/AC/off without touching the set temperature, that would be first thing to check.
To answer your question, you need to save the temperature somewhere, either try the variable approach, or publish to a MQTT topic, and use data_template for service to set the thermostat back to the saved temperature.

Tried it. The only way to turn it off is to set to the 4,5. I’m not so familiar with variables and templates :confused:

What kind of thermostat do you have?
Mine - an Emerson Sensi - doesn’t connect to HA directly, I have to go through Wink.
Through Wink, HA also has acccess to the scenes I defined in Wink.

I see this in the Dev-State:
image

I have an MAX!. It also doesnt connect directly but with gateway named MAX! Cube. For me it looks like this

image

The operation_mode is what drives mine - and it seems to be in line with the overall state of the component.

What happens when you set the state to ‘vacation’ or ‘auto’?
Does the thermostat still switch the heater on & off?

I assume you setting the ‘temperature’ to 4.5 just turns the heat off because the ‘current_temperature’ is higher than that.

I’m currently working on another automation where I store a value in a json-file and retrieve it for later use, e.g. after a reboot:

curl -k -H POST http://192.168.7.16:8123/api/states/sensor.sprinkler_last_runval > /home/homeassistant/.homeassistant/files/last_sprinkler_runtime.json

This is not working 100% for me yet so I can’t share it here :frowning:

when I set to vation od auto - it turns to the temperature assigned in MAX! Cube gateway. When i set 4.5 the thermostat turns off - it doesnt matter what temperature is in the room (it can be below 0) the heater wont heat. Earlier i found this:

but don’t know how to use slider.

1 Like

Got a solution. Need to use input_number to store the temperature and then a template in an action.

In configuration.yaml

input_number:
slider1:
name: Slider
min: 5
max: 30

in automations.yaml

#when opening window

  • alias: Coolcam_bedroom_off
    trigger:
    platform: state
    entity_id: binary_sensor.sensor
    to: ‘on’
    action:
    • service: input_number.set_value
      data_template:
      entity_id: input_number.slider1
      value: ‘{{ states.climate.bedroom_termostat_1.attributes.temperature | float }}’
    • service: climate.set_temperature
      entity_id: climate.bedroom_termostat_1
      data:
      temperature: ‘4.5’ ## 4.5 is off

#when closing window

  • alias: Coolcam_bedroom_komfort
    trigger:
    platform: state
    entity_id: binary_sensor.sensor
    to: ‘off’
    action:
    service: climate.set_temperature
    entity_id: climate.bedrrom_termostat_1
    data_template:
    temperature: ‘{{ states.input_number.slider1.state | float }}’
4 Likes