Temperature units wrong after upgrade to 2021.9.0

I have a Shelly H&T sensor that has been delivering temperature to my dashboard for months. The units_of_measurement is F. Prior to 2021.9.0, my temps displayed fine (73 °F). After upgrading, I’m now seeing 179 °F. Nothing else changed.

Why is the system converting to Celsius now? Like I said, nothing else changed except I upgraded. This system has been working fine for months.

FYI, this what I get back from the developer page:

sensor.shelly_h_t_familyroom_temperature:

state: 172

state_class: measurement
unit_of_measurement: °F
friendly_name: Shelly H&T familyroom Temperature
device_class: temperature
1 Like

I don’t think it converts to Celcius.
73°F converted to Celcius would be 22.8°C.

…or is it maybe 17.9°C

Id check the battery, I had a similar issue of weird (high) temp reading on a battery powered sensor recently. (It was not a Shelly) … Just a thought ?

Or it takes the fahrenheit value as celsius and converts that to fahrenheit. 73°C is 163.4°F.

Edit: wrong deduction.

It’s most likely not a faulty sensor. If the integration is incorrectly producing a unit_of_measurement that is ºC when the result is ºF, home assistant will convert it. So either 1 of 2 things happened. OP changed the unit of measurement to ºC or the integration did. Based on OPs repsonses, I would assume that something changed in the integration and he needs to track down that change. Worse case, he can override the unit of measurement to ºF and it should not convert it anymore.

1 Like

A couple of things:

  • My unit is not faulty. It is reading exactly the same as it always did. I have all the values going back months. However, if you look at the graph, the value jumps from 74 to 165 immediately after I upgraded HA.

  • The Shelly used a USB adapter. No battery issues.

  • I changed nothing in my config. The only thing that changes was I upgraded Home Assistant to 2021.09.1.

All the evidence points to HA didn’t used to convert my sensor value. It would accept my value of 74 and then use the customization to add F as the unit_of_measurement. However, now it looks like HA is treating my sensor value as C and converting to F before displaying.

How can I get it to stop doing that?

see this line. However you should report the issue to the core shelly integration. Someone who knows shelly might shed some light or fix the issue.

I did override the unit of measurement to °F. Worked fine until I upgraded.

Regarding the Shelly integration, I’m not using that. I’m using MQTT since I setup many Shellies before that integration was available. I didn’t bother converting once it became available to be consistent. However, maybe this will be a reason for me to do so.

what’s the value in MQTT and what does the configuration look like for that sensor? Are you using MQTT discovery?

The value in the MQTT message is 74, which is expected since the Shelly is configured to output °F.

I’ve always used the Shelly Discovery python script. Works flawlessly.

and does the discovery topic that’s created contain a unit of measurement?

It does, but it has always been C because the Shelly announce doesn’t include that (I pinged the developer of shelly_discovery.py. However, HA never seemed to do anything with that until now. My first guess is that HA started listening to that configuration entry with the update. My MQTT config is listed in the original question above.

I’m going to experiment with switching to the Shelly integration.

Well that’s ultimately the problem. If you can get the script to have the correct unit_of_measurement, then the problem should be fixed. My guess is that the changes with the latest energy updates cause the unit of measurement to be loaded at a different time from the customizations, which is causing issues on your system. Ultimately making your band aide (setting ºF) no longer work.

For what it’s worth, you’re not crazy and you’re not alone. I’m having the same issue with the Glances integration. As soon as I updated from 2021.8.8 to 2021.9.1 alarms started going off that my server hard drives were overheating at 78C. I eventually solved the problem by appending _f to the names of each temperature entity in the Glances integration, and then creating a template entity with the original name to convert it back to C (see below). That seemed easier than trying to track down every reference to the entities in automations, scripts, Lovelace panels, and Grafana dashboards. If it ever switches back, this should be simple to undo. Maybe this is a convenient work-around for you as well.

- platform: template
  sensors:
    glances_schlerver_sda_temperature:
      friendly_name: "Glances Schlerver sda Temp C"
      unit_of_measurement: 'ºC'
      value_template: "{{ ((states('sensor.glances_schlerver_sda_temperature_f')|float -32) * (5/9))|round(1) }}"
    glances_schlerver_sdb_temperature:
      friendly_name: "Glances Schlerver sdb Temp C"
      unit_of_measurement: 'ºC'
      value_template: "{{ ((states('sensor.glances_schlerver_sdb_temperature_f')|float -32) * (5/9))|round(1) }}"
1 Like

I started swapping over my Shellies from MQTT to the Shelly integration. Those are working excellent, and the units are correct.

1 Like

Maybe due to:

You should open an issue

Having the same issue here. I use Farenheit for weather and ambient sensors, but I prefer server and 3D printer measurements in Celsius. To work around this, I used to set the unit_of_measurement to “C” without the degree symbol, causing the temperature conversion to not pick them up. After 2021.9.0, my OctoPrint MQTT sensors still read as C but they are incorrectly being converted to Farenheit. Temperature sensors started reading as 100 degrees C and triggering alerts.

remove the device class

I came for the same issue, temperature values from OctoPrint (mqqt via auto-discovery) since 2021.9.x branch. The temperature sensors are defined in the mqqt payload as:

availability_topic: octoprint/mqtt
payload_available: connected
payload_not_available: disconnected
name: OctoPrint Tool 0 Temperature
unique_id: 2626fde636f44a2bb46dc6dcebe7f0ad_TOOL0
state_topic: octoprint/temperature/tool0
unit_of_measurement: °C
value_template: ‘{{value_json.actual|float}}’
device:
identifiers: 2626fde636f44a2bb46dc6dcebe7f0ad
name: OctoPrint
manufacturer: Clifford Roche
model: HomeAssistant Discovery for OctoPrint
sw_version: HomeAssistant Discovery for OctoPrint 3.3.0
device_class: temperature
icon: mdi:printer-3d-nozzle
platform: mqtt

And mqqt payload shows like such:

actual: 23.71
target: 0

but my sensor still shows like this:

octoprint Tool 0 Temperature: 73.69 C