# Force Temperature to Fahrenheit?

The ecowitt integration is now Celsius and won’t go back to Fahrenheit. Dude wtf

Don’t know what you expect, but a solution could be to create a custom sensor that calculates Fahrenheit.
The calculation isn’t hard: (TempC x 1.8) + 32 = TempF

From F to C, for those interested: (TempF - 32) x (5/9) = TempC

Oh that’s actually easier than I thought it would be with the maths.

How would I put that in template though to make a sensor? I tried and nothing showed up. It’s just making “sensor.mainroomtemperature1c” into something in Fahrenheit called “sensor.mainroomtemperature1”

Here is how to make a template sensor.

Your template should look something like:

``````{{

(states('sensor.temp_c')|float(0) * 1.8 + 32) | round

}}
``````

i did this?

``````      - name: mainroomtemperature1
unit_of_measurement: '°F'
value_template: >-
{% set t = states('sensor.mainroomtemperature1c') | float %}
{{((t)*9/5)+32}}
``````

The below code should be added to your configuration.yaml file, assuming your sensor is actually named ‘sensor.mainroomtemperature1’.

If this is the first custom sensor, then it should be just copy/past. if it’s not your first, skip the `sensor:` and put it in line with the other custom sensors.

``````  - platform: template
sensors:
mainroomtemperature1f:
friendly_name: "Temp F"
unit_of_measurement: '°F'
icon_template: mdi:temperature-fahrenheit
value_template: "{{ (states('sensor.mainroomtemperature1c')|float(0) * 1.8 + 32) | round }}"
``````

The new sensor of this example is named `sensor.mainroomtemperature1f`.

You can try to reload via ‘Developer Tools’ → ‘YAML’ → ‘Template Entities’, but first check the config by clicking ‘Check configuration’ in that same screen.

edit:
P.s. your calculation is likely to be incorrect based on the calculation rules. Multiplying goes before dividing, so it should be `(states('sensor.mainroomtemperature1c')|float(0) * (9/5) + 32) | round`.

1 Like

that makes sense now. thanks.

You’re welcome.

If you mark it as solution, it’s easier to find for others that have the same issue/need

How do I do that?

If I remember correctly the topic starter can just mark it at the bottom of the specific post.

I did a quick search and it seems that your topic must have a category, which yours doesn’t seem to have.

So I’d suggest you add a category first. You can do so by clicking the pencil at your topic title. Then mark a post as a solution.

That’s kinda stupid.

I’d say that this post (post 7) is the solution, and not the post that describes how to mark a post as a solution

I mean it was a solution for solutions. It was solution-ception. Gotta give it to Leonardo DiCaprio. Anything that convoluted and confusing must be a good movie. I think that’s how that works.