Recovering the previous state (or temporary climate operation off)

I’m using a generic thermostat and I want to cut the heating when opening a door, and restart it when the door closes. I do this by lowering the temperature setpoint and set it back to a default setpoint. However, I’d like to set it back to the setpoint it had when the door opened.

Is it correct that the services hold_mode and operation_mode are not supported by the generic thermostat? So I can’t set the generic thermostat to Off or Idle while the door is open.

How can I easily save a state or fetch the previous state? (Use an input_slider to save the state?)

I use a slider to save the previous temp and return to that temp in a similar automation I’m using. Probably your best bet.

How do I set the climate temperature setpoint from the input_slider?
This doesn’t work:

action:
  service: climate.set_temperature
  data:
    entity_id: climate.living_room
    temperature: '{{ states.input_slider.temperature_door_opened.state | float }}'

Log entry:

17-03-05 08:36:24 ERROR (MainThread) [homeassistant.core] Invalid service data for climate.set_temperature: expected float for dictionary value @ data[‘temperature’]. Got ‘{{ states.input_slider.temperature_door_opened.state | float }}’

Try:

action:
  service: climate.set_temperature
  entity_id: climate.living_room
  data_template:
    temperature: '{{ states.input_slider.temperature_door_opened.state | round() }}'

You need to use data_template any time you are attempting to pass a template to the automation. I also used round() to drop the decimal. If I remember correctly Nest wanted an integer, but depending on your thermostat you might be able to use float.

HI,

Can anyone guide me how the automation should look like to save the state from before opening the window ?
Now my automation look like like this (opening and closing)

  • alias: Coolcam_bedroom_off
    trigger:
    platform: state
    entity_id: binary_sensor.sensor
    to: ‘on’
    action:
    service: climate.set_temperature
    entity_id: climate.sypialnia_termostat_1
    data:
    temperature: ‘4.5’ ## 4.5 is off ##

  • alias: Coolcam_bedroom_comfort
    trigger:
    platform: state
    entity_id: binary_sensor.sensor
    to: ‘off’
    action:
    service: climate.set_temperature
    entity_id: climate.sypialnia_termostat_1
    data:
    temperature: 21