Dht22 unit selection

Hello - I’ve searched far and wide and can’t find a response that hits my use case.

I’ve been using a few dht22 sensors with ESPHome, but recently the temperature unit switched from F to C without any change from me. Imperial is set in HA settings, how do I configure the sensor to output F, or must I do a conversion filter (i didn’t do this in the past, which is why I’m confused).

Many thanks.

When recently?

Did it coincide with an update to HA? Or esphome?

Yeah, that’s a solid question - unfortunately, I can’t definitively say.

Is this what you are looking for?

ESPHome uses the Celsius temperature unit internally, and I’m not planning on making converting between the two simple (:wink:), but you can use this filter to convert Celsius values to Fahrenheit.

  - lambda: return x * (9.0/5.0) + 32.0;
unit_of_measurement: "°F"

I did find that - but I’ve never had to implement it in the past, which is what threw me. Thanks for the reply, though, looks like I’ll head down that road.

There was I think a recent change to how ha handles temp conversion. Don’t ask me details, but you will probably find it in the last 3 or 4 months release notes.