Farenheit to Celsius (and vice versa) Helper

Would like a F to C and C to F helper option.

Just change your units

Click the entity, then the cog icon in the pop-up card, then:

With my setup i dont even have a drop down for the temperature in any part of the settings(unless there’s some hidden preference somewhere).
My only reference to temp on HA is

mqtt:
    sensor:
      - name: "Wemos D1 Temperature"
        state_topic: "home/wemosd1r1/temperature"
        unit_of_measurement: "°F"

And if I remember correct my wemos is converting the temp for me.

I know of that option, but I was thinking more along the lines of having a default unit, but a helper in case you need the same sensor displayed in a different unit.

I’m new here though, and maybe that’s already an option? I just remember reading in the forums of people manually doing the conversion in YAML years back, and I figured I’d find a helper tool for that by now.

My last case use scenario involved calculating VPD with a sensor that was in F, and I needed C as to not make the formula more complicated. In the end though, I just opted for the VPD Chart HAC.

Apparently the idea is not too popular, so I understand either way. Thanks for the reply though!

1 Like

I was thinking more along the lines of having the same sensor display C and F at the same time. A default unit, but the option to convert the default to C or F or K. If I change the unit, it’s just one or the other.

Just thought it would be neat. A helper, so you don’t have to manually do it in YAML, as I know some have.

1 Like

Like this?

configuration.yaml

mqtt:
  sensor:
    - name: "Wemos D1 Temperature"
      state_topic: "home/wemosd1r1/temperature"
      unit_of_measurement: "°F"

sensor:
  - platform: template
    sensors:
      wemos_d1_temperature_celsius:
        friendly_name: "Wemos D1 Temperature (°C)"
        unit_of_measurement: "°C"
        value_template: >
          {% if states('sensor.wemos_d1_temperature') not in ['unknown', 'unavailable'] %}
            {{ ((states('sensor.wemos_d1_temperature') | float - 32) * 5 / 9) | round(2) }}
          {% else %}
            unavailable
          {% endif %}

result

1 Like

Exactly.

No votes for this Helper, so YAML it is :slight_smile:

Ill vote for it but the yaml still creates a helper

1 Like