preface; been at this under a week, still trying to figure out most of the HA stuff. go easy on me.
I have a 4-in-1 sensor which reports temperature in F only. I’m in Canada, i want to see it in C.
How do i do this?
I have spent some time reading threads, and i think it’s via a template of some sort. Took me about 15 minutes just to figure out how to even add the customize.yaml into the config. (most of my config up till now has been GUI. so very few yaml configs except an mqtt and tts entry. )
i’ve put this in my customize.yaml: everything is indented with spaces, 2 per level.
Not sure if this is what you want or will work in your situation but I have my HA set up to read everthing in F as I live in the United States. But I also recently added my 3d printers and I wanted those temp sensors to report in C.
I was able to make the change by putting this line in my configuration.yaml.
homeassistant:
customize: !include customize.yaml
Then in my config folder I created a folder named “customize” and added these lines, which set each sensor entity that I wanted to report in C.
sensor.ender3_actual_bed_temp:
unit_of_measurement: 'C'
friendly_name: Bed Temperature
icon: mdi:thermometer
sensor.ender3_actual_tool0_temp:
unit_of_measurement: 'C'
friendly_name: Nozzle Temperature
icon: mdi:thermometer
sensor.ender3_target_tool0_temp:
unit_of_measurement: 'C'
friendly_name: Nozzle Target Temp
icon: mdi:thermometer
sensor.ender3_target_bed_temp:
unit_of_measurement: 'C'
friendly_name: Bed Target Temp
icon: mdi:thermometer
yea, i found your thread, and I did try something like that, but all it did was change my sensor from 73 F to 73 C, didn’t actually change the numeric value.
Like I said this may not work for you if your device only reports in Fahrenheit. You may have to do some conversion to get it to show in celsius. I am also still really new to this. Make sure you add the customize command in your configuration.yaml to point to the new folder.
Manually configured mqtt or auto-discovered ? If manual configured, you can calculate the F -> C . I think (but should check) you need to substract 32 and then multiply by 5/9.
i dont currently have a sensor.yaml
i assume that would be addressed with a sensors: !include sensor.yaml ?
I did try just setting the unit of measure to C, but that didn’t auto-change the value, it just made it report 74 C. when i try to do ‘°C’ with the ‘degree’ i get the following error:
‘utf-8’ codec can’t decode byte 0xb0 in position 76: invalid start byte
it doesn’t like that character. is there an alternate unicode for the degree symbol?
regardless, i’ll try under sensors next, as i was trying to put that in customize.
Thanks.
You can test your calculation in the template section of developer tools: developer tools → template
type in your formula and see what it evaluates to. Once it works, you can put that calculation in your template sensor (in the sensors.yaml file if that is what your configuration points to.
couple things… it didn’t like the capitol ‘C’ in the name, had to make lower case. and the quotes in the quotes, changed to double quotes. that is returning a C value now on that new sensor.
next question… how to round the value_template to 2 decimal points ?
thank you so much… such a little thing to bang head into wall for two hours for!
one last question, trying to add the thermometer icon to the new sensor, but when i add
icon: mdi:thermometer
under the sensor, it says [icon] is an invalid option for [sensor.template]
would i have to add the icon line under customize instead?