How to round off value of Nest Temperature identity?

Hello,

I have my Nest Thermostat integrated by adding 4 lines of code in my config.yaml like client id , client secret, project id and subscriber id.

After that I got 3 new identities: Climate, Temperature and Humidity.
However the temperature shows a number with five decimals…

How can I round this off with just one decimal?

Hello,

Did you find a way ?
I’ve got the same problem …

Edit : Just find a way with round(x)

 - service: input_number.set_value
              data:
                entity_id: input_number.yourdata
                value: "{{ ( states('input_number.yourdata' ) | float +  0.2 ) | round (2)  }}"

Franck

Where do you put that?

I put it in automation.

on each modification it rules :

- id: 'round yourdata'
  alias: round the value
  description: 'roud the value after each modification'
 
  condition: []
   
  trigger:
    - platform: state
      entity_id:
        - input_number.yourdata
        
  action:
    - service: input_number.set_value
      data:
        entity_id: input_number.yourdata
        value: "{{ ( states('input_number.yourdata' ) | float  ) | round (2)  }}"

(On previous post, I show you how make a round after each increment of 0.2)

Franck

sorry to be really thick but what do I put for input_number.yourdata? Is it input_number.sensor.living_room or have i got this wrong?

Arff No, you can’t write it like this

Declare an input numbe like this in your input number file

 
inputsensorlivroom:
    name: input sensor livingroom
    min: 0
    max: 30
    step: 0.1
    unit_of_measurement: °C

In your automation file :


- id: 'round'
  alias: round your data
  description: 'round your temp data'  
  
  trigger: 
    - platform: state
      entity_id: 
          - sensor.living_room
        
  condition: []
  
  action:

# This transfers your sensor value in input number 
# (input_number input sensor livingroom = sensor living room)
    - service: input_number.set_value
      data:
        entity_id:  input_number.inputsensorlivroom
        value: "{{  states('sensor.living_room' ) | float  }}"
 
# This round input number value
    - service: input_number.set_value
      data:
        entity_id: input_number.consigne_salon_nuit
        value: "{{  states('input_number.consigne_salon_nuit' ) | round (2)  }}"
    And use this new input_number value in your card

I’m just not getting this to work. :laughing: :slightly_frowning_face:

Can anyone help or point me in the direction of a good step by step for a complete noob like me to help me solve this, please?

** I would like the number to show with no decimals points so instead of 19.2 just 19 would be good, so instructions with the round included would be appreciated. **

Tried loads of times and just think I’m putting certain parts of the instructions above in the wrong place or in the wrong order.

My Lovelace card is like this

Screenshot 2021-04-17 111627

The entities related to this Thermostat are these one’s

image

  • Downstairs - Humidity = sensor.downstairs_humidity

  • Downstairs - Temp =sensor.downstairs_temperature

  • Downstairs Thermostat = climate.downstairs_hall

I tried to create an Automation like the above suggests however where is the input number file? That’s the bit that I’m maybe missing.

Thanks in advance.

I’ve opened a pull request to adjust the precision of both the temperature and humidity sensors:

1 Like

This PR has been merged, so hopefully the change will be in the 2021.11 release.

2 Likes

Nice job, @michaeldavie! Was doing some HA stuff this morning and found this thread to adjust my Nest button numbers. So glad I it got merged!

Thanks so much for this! Not seeing the same number in HA and on the actual Nest device was bothering me more than I’d like to admit.

1 Like

Has this been done?
It’s been bugging me too. I’ve been trying to find a way to round the temperature to a 0.5 number.
So as to have 20.5 or 21 instead of 20.7.
My Nest climate still shows 22.3 right now. So I’m guessing this hasn’t been done yet.

The fix was to change it from 22.3333333333 to 22.3. So you are right, this was not what you were looking for. My impression is you can fix this with templating in the frontend, but i don’t know the details of how to accomplish this. (Hope this is helpful as a quick reply, but likely someone more knowledgeable has a real answer for you)

Figure it out

- platform: template
  sensors:
    livingroom_current_temperature_rd:
      friendly_name: "Current Temperature"
      unit_of_measurement: °C
      value_template: >
        {{ (((state_attr('climate.living_room', 'current_temperature') | float) * 2) | round ) / 2 }}