Template for front end question

This is my sensor template to round off the temperature to no decimals…

- platform: template
      unit_of_measurement: "°F"
      value_template: '{{ states.sensor.budd_st_weather_temp.attributes["Temperature"] | round(1) }}'

So this is what it shows…


How can I add ‘F’ to the 60 [current temp].
I changed the friendly_name in the states in the config but it keeps going back to the original round_temp. I’ve tried adding ‘friendly_name’ within the template but it doesn’t change anything.
What am I not doing correctly here?

I put that in custom.yaml and it’s good now :slight_smile: Still trying to figure out how to add the ‘F’ to the 60 though.

Thanks all!

At first sight I would expect this to work. However, when defining sensors like these it is preferred to add a device_class. This affects it behaviour, including how it is displayed. In this case you should add
device_class: temperature

Also do not do this:

Do this:

value_template: "{{ state_attr('sensor.budd_st_weather_temp', 'Temperature')| round(1) }}"



1 Like

Thank you Tom! And Thank you Edwin_D. Made those changes… The info is always good to learn!!!

Currently it’s hard for me to read a ton of stuff I’m in the middle of an older family member who’s not doing well… NOT that you guys wanted/needed to know any of that but I just wanted you to know how much I appreciate everything you all do here!!!

OH Tom I found that somewhere and basically cut/copy/paste verbatim so knowing not to use what I used it a great thing!!!