Set Target temperature PLUS adjustment

Hello!

I would like to change the target temperature in an automation. The new temperature should be the current temperature from the thermostat or another temperature sensor, PLUS an offset value stored in a helper.

If I specify the value of the helper like this, it works:

service: climate.set_temperature
data:
  temperature: '{{ states.input_number.heating_system_offset.state }}'
target:
  entity_id: climate.heating_system

But any attempt to add another value (from the thermostat or another temperature sensor) has not worked so far. Unfortunately I always get different error messages.

What is the correct format to process the temperature values of the thermostat or another temperature sensor?

Thanks for any help!
:slight_smile:

I believe it would be something like this.

service: climate.set_temperature
data:
  temperature: >-
   "{{ states('input_number.heating_system_offset') | float(0) + 
       state_attr('climate.heating_system', 'temperature') | float(0) }}"
target:
  entity_id: climate.heating_system
1 Like

Thank you very much for the help and the tip! :slight_smile:
I will try it and then give feedback.
Thank you!

When I run this single action, then I get this error message:

expected float for dictionary value @ data[‘temperature’]. Got None

:-((

When I go to the developer → template and substitute my entities I get this:

Would you post your entire automation? It would be helpful.

Also could you put the single line in developer → template and see what the results are?

Thank you very much for your help!
I will try it with the developer…

Thanks again for your help!
It worked in the developer. Apparently a formatting error had crept into the automation.

How can I save the current temperature in another helper? Because so the set target temperature is always only added. This is then a little too hot for me! :wink:

You can create a sensor that is readily available for you. This would go in your configuration.yaml
If you use !include then template: would need to go away

template:
  - sensor:
    - name: "my_temp"
      unique_id: "my temperature sensor"
      state: >-
         {{ states('input_number.heating_system_offset') | float(0) + 
             state_attr('climate.heating_system', 'temperature') | float(0) }}

Do you know about scheduler? It is a HACS component

https://awesomeopensource.com/project/nielsfaber/scheduler-component

Thank you very mich again for the help!
:slight_smile:

Maybe I have expressed myself a little misleadingly…
…I would like to save the current target temperature in a helper.
Then set the current target temperature + offset and after a certain time or at a certain time, the old / normal target temperature (without offset) should be set again and activated.

Do you mean something like this?

action:
  - service: input_number.set_value
    data:
      value: "{{ (states('input_number.offset') | float) + (state_attr('climate.heating_system', 'temperature') | float) | int }}"
    target:
      entity_id: input_number.my_temp
  - service: input_number.set_value
    data:
      value: "{{ (state_attr('climate.heating_system', 'temperature') | float) | int }}"
    target:
      entity_id: input_number.my_orig_temp
  - service: climate.set_temperature
    data:
      value: "{{ (states('input_number.my_temp') | int) }}"
    target:
      entity_id: climate.heating_system

Thanks for the post and sorry I’m just getting back to you. I will give it a try… :slight_smile:

I think you were along the right track early on… just needed to get rid of the Quotes around the values

here is mine that is working:

service: climate.set_temperature
data_template:
  hvac_mode: heat
  temperature: >-
    {{ states('sensor.suite_f_current_temperature') | float(0) + '5' | float(0)
    }}
target:
  entity_id: climate.suite_f_2