I’ve got two MQTT sensors for my BBQ ThermPro sensor which works great. The temperature is sent in degrees C, and I’d like to create two new sensors to show the value in degrees F. I’ve got the following config in configuration.yaml:
You don’t need to perform the calculation. Home assistant will do it for you if you put the unit_of_measurement as ºC. It will see that your system has a unit of ºC and convert it to what is set inside your configuration.
You cannot display ºF and ºC on the same system in Home Assistant because of this.
Hi Petro - Thanks for the reply, unfortunately not quite sure what you mean - What should the configuration be then?
I don’t want the unit of measure to be ºC - I want to display ºF on my dashboards but don’t seem to be able to set the unit_of_measure in the UI editor:
I’m also confused as to why there are two graphs shown here for a single entity.
I’m wondering if in trying to get this set up there’s some cruft in the history/HA DB which is confusing issues. I’ve cleared state from home-assistant_v2.db using sqlite3, but still no dice.
You may need to delete your current database. It should convert your temperatures to whatever is set on your system.
Your system units are set inside Configuration -> General Configuration:
Once you clear your database (or wait for it to clear). All temperatures should naturally convert to ºF if you properly set the units on the sensors themselves. I.E. if the unit_of_measurement on the integration is set to ºC, it will convert it to ºF. Any ºF will not be converted, just passed through.
The answer has already been posted but I’ll post my results anyway.
After some experimentation, I can confirm that excluding unit_of_measurement is (currently) the only way of preventing automatic temperature conversion.
My Unit System is set to Metric and the following Template Sensor allows me to display sensor.outside_temperature not in the default Celsius units but in Fahrenheit.
outside1:
friendly_name: "Outside Temperature V1"
value_template: "{{ float(states('sensor.outdoor_temperature')) * 9 / 5 + 32 }}"
device_class: temperature
The resulting badge displays the converted value but lacks a unit symbol.
So while I can now get the right metric, I can no longer display a graph of it, as the history card in Lovelace only displays a graph if unit_of_measurement is specified