Raising temperature by one degree - Climate device

Hi,

As part of an auomtation for a Xiaomi Wireless Switch I’d like to raise the temperature by one degree in my Sensibo Climate controller, I’d be glad to receive some directions on how can I set the temperature to (+1) from the current one

Thanks,
Ohad

You can get the current temperature with the template

{{ state_attr('climate.your_thermostat', 'current_temperature') }}

You could then use the following in an automation to increase that by one:

- service: climate.set_temperature
  data_template:
    entity_id: climate.your_thermostat
    target_temp_low: {{ (state_attr('climate.your_thermostat', 'current_temperature')|round(0)) + 1 }}

Here we take the current temperature, round it to the nearest whole number, then add one.

3 Likes

Yes, this should work ! thanks a lot for this

hello!
this does not work for me. here is my code:

heat_up:
  alias: heat_up
  sequence:
  - data:
        entity_id: climate.ac_corridoio
        temperature: {{(state_attr('climate.ac_corridoio' , 'temperature')|round(0)) + 1 }}
    service: climate.set_temperature

i get this error:

missed comma between flow collection entries at line 27, column 74:
     ... te.ac_corridoio' , 'temperature')|round(0)) + 1 }}
                                         ^

this does not make sense to me, can you help me understand the problem?

Did you ever figure this out?

@francesco.fabbro.89 I’m sure you’ve figured this out by now, but for the others who are looking in the forums for the answer, your example needs to use ‘data_template’, and your template must be in quotation marks:

script:
  heat_up:
    alias: heat_up
    sequence:
    - service: climate.set_temperature
      data_template:
        entity_id: climate.ac_corridoio
        temperature: "{{(state_attr('climate.ac_corridoio' , 'temperature')|round(0)) + 1 }}"

I also don’t see the need to round the temperature to the nearest integer. My thermostat can do 1/2 degrees, so I’d use this similar template instead. If yours only does whole degrees, then stick with what you have.

{{ state_attr('climate.ac_corridoio' , 'temperature') | float | round(1) + 1 }}
4 Likes

I endorse this as my thermostat does 1/10ths :+1:

I’m not sure what causes this sometimes, but I’m betting it’s the lovelace thermostat card. Sometimes I’ll get the MQTT temperature command but with 22.000000003 in the payload instead of just 22.0. My thermostat is not that precise :slight_smile:

It’s just trying to tell you, it luvs you 0.000000003 more ! :heart_eyes:

1 Like

@anon15118449
Not sure if you are interested but for completeness : -
I say there is an issue with the round function but both Phil and petro say it’s an epislon numerical error not strictly limited to round() but that round() just makes it more apparent.

Instead use a text formatting function to nail this little bugger into place

“{{ ‘%.3f’ | format(distance(states.device_tracker.life360_bob)) }}”

2 Likes

FIXED:
I used the visual editor and somehow got this YAML which works:

alias: Temperature Up
sequence:
  - service: climate.set_temperature
    data_template:
      entity_id: climate.hallway
      temperature: '{{(state_attr(''climate.hallway'' , ''temperature'')|round(0)) + 1 }}'
mode: single
icon: mdi:up

Visual Editor

Deleting the first line…still wrong. :face_with_symbols_over_mouth:

1 Like

Hi all. Wanted to ask advice, please. Wanting to achieve a similar thing, but getting errors I don’t understand.

Using the template dev tool, the following works nicely:

{{ (state_attr('climate.lounge', 'current_temperature')|round(0)) + 1 }}

And so I have put the following in as an action in an automation:

- service: climate.set_temperature
    data_template:
      entity_id: climate.lounge
      target_temp_low: {{(state_attr('climate.lounge', 'current_temperature')|round(0))+1 }}

But the automation stops, encountering an error:

some but not all values in the same group of inclusion ‘temperature’@ data[]

Any advice? I’m wondering if I can save the template and call that value in the automation? Would helpers work here? I have also tried setting up this as a script that’s called, but the script errors in the same way.

Thanks, Matt

Managed to get it working by script, then the automation runs said script.

Script:

sequence:
  - service: climate.set_temperature
    data_template:
      entity_id: climate.lounge
      temperature: "{{(state_attr('climate.lounge' , 'current_temperature')|round(0)) + 1 }}"

Couldn’t get this running as an action within the automation itself, though.

matt

1 Like

Helped sort a similar problem for me. Well done.

I found that if I setup an automation in the editor that looks like this…

Then switch to edit in yaml, and replace the temperature with this code (from the advice above), I didn’t need to create a script, it works directly in the automation.

  temperature: >-
    {{(state_attr('climate.office_air_conditioner' , 'temperature')|round(0)) -
    1 }}

Thanks to all the great input in this post, I have my automation working to increase / decrease the temp by voice command. However I’d like to take this one step further.
I currently have the conversation response set to state “lowered (or raised) target temperature by 1 degree”. Does anybody know a way to customize the conversation response to reply with the resulting temperature setting? For example, if I tell HA to increase the temperature by one degree, I want it to tell me that the thermostat is now set to 68 degrees.

Please post your automation.

Should have waited another 15 minutes before posting. I got it working!!!

          - set_conversation_response: >-
              target temperature has been set to 
              {{(state_attr('climate.upstairs_thermostat' ,
              'temperature')|round(0))}}
            enabled: true
1 Like

I’ve tried them all, but they just don’t work for me:

action:
  - service: climate.set_temperature
    data_template:
      entity_id: climate.split_salone
      temperature: {{ state_attr('climate.split_salone' , 'current_temperature') | float | round(0) + 1 }}

Error loading /config/configuration.yaml: while parsing a flow mapping
at column 21
expected ‘,’ or ‘}’, but got ‘scalar’
at column 80
My thermostat can do 1/2 degrees.

What does the template editor tell you?