Prevent temperature conversion

I added a Shelly H&T sensor to my family room to experiment. I have the Shelly configured to output MQTT in Fahrenheit. Messages come through fine at 70°F, just like I expect. However, if I ask HA or Alexa what the temp is in the family room, it shows 158°. How do I tell HA not to convert my temperature sensor values?

Well, I found the source of the problem. Even though my Shelly H&T is configured to use F, it announces itself as:

name: Shelly H&T familyroom Temperature
state_topic: shellies/shellyht-familyroom/sensor/temperature
force_update: 'False'
unique_id: shellyht-familyroom-temperature
qos: 0
device:
  identifiers:
    - e0980695711d
  name: Shelly H&T familyroom
  model: Shelly H&T
  sw_version: 20200812-091311/v1.8.0@8acf41b0
  manufacturer: Allterco Robotics
unit_of_measurement: °C
device_class: temperature
value_template: '{{value|float|round(1)}}'
expire_after: 43200
platform: mqtt

Looks like the problem may be on the Shelly side when it announces.

Then again, if I use the Developer Tools and ask for the sensor value, I get:

unit_of_measurement: °F
friendly_name: Family Room Temperature
device_class: temperature

But the HA value is still 158 even though the payload on the MQTT message was 70.0.

If it’s reporting to HA the unit DegC regardless of the setting, you might as well change the shelly to actually use DegC. Everywhere in HA will convert it for you (the front end, alexa, etc) to your default temperature unit (DegF) so it should be fine I think.

That’s what I ended up doing. I also updated my NodeRed to convert to F before writing into InfluxDB.

The thing is that the H&T is reporting the temp as F and saying so, but because of the original announcement HA thinks it is C. I have a Dyson fan that I capture the data the same way, and that one does not get converted.

Home assistant naturally converts temperature. It’s the only thing that is converted for the user in HA. The root cause of your issue is that your unit_of_measurement from shelly to HA is ºC. I don’t use shelly so I can’t comment on how to change the configuration. But if you could get it to change the configuration from ºC to ºF, it wouldn’t convert and you’d get the correct result.

I have a ticket open with Shelly. It does properly publish temperature data in the correct units, but that original announcement is always unit_of_measurement: °C.

Is there a way to override that in the entity settings for HA? Using customize, for example?

Looks like this fixed the Shelly issue. I added to my customize.yaml:

sensor.shelly_h_t_familyroom_temperature:
unit_of_measurement: F

1 Like