Unit_of_measurement "ºC" not valid for device_class "temperature"?

I just updated homeassistant to 2025.4.4 and I got a warning as per the subject, saying that the manually configured sensor wouldn’t work after 2027 something (I inadvertently clicked on ignore and I no longer see the message so it is from memory).
I’ve searched and everywhere it says that ºC is a valid unit for temperature.
This is the configuration of the sensor in configuration.yaml

mqtt:
 [...]
 sensor:
   - name: "Temperatura actual"
     state_topic: "temperatura/actual"
     device_class: "temperature"
     unique_id: temperatura_actual
     unit_of_measurement: "ºC"
     expire_after: 15
°C

Your degree has a little " - " below the circle. Could that be it? Perhaps its just my font I’m viewing it on.


Interesting the little bar below the circle doesn’t appear when i view your post on my phone. :thinking:

Your MQTT Sensor configuration is not using the correct degree symbol.

This is from your configuration.

    unit_of_measurement: "ºC"

This is the correct degree symbol.

    unit_of_measurement: "°C"

It’s smaller than the one used in your example but may be difficult to see the difference when viewed in a forum post. I suggest you copy the two examples into a text editor and then the difference will be more noticeable.


Here’s a screenshot from a text editor where the difference is more noticeable.

image

Remove the incorrect, larger degree symbol from your configuration and copy-paste the correct, smaller degree symbol from my example.

Alternatively, here’s how to enter it from the keyboard (using Windows).
Microsoft Support - Insert ASCII characters - degree symbol

  • On my phone (using Samsung Browser) I don’t see the underbar and both the incorrect and correct symbols appear to be the same size.

  • On my PC (using Firefox) I don’t see the underbar and the two symbols have subtle but noticeably different sizes.

It appears that the choice of browser (and possibly what language/region) influences the appearance of the two symbols.

In contrast, the symbols are noticeable different when viewed in a text editor.

https://en.wikipedia.org/wiki/Degree_symbol#Lookalikes

Its a U+000BA masculine ordinal indicator. You can tell its lunchtime. Not by the symbol but that I looked it up. Now ive looked up the degree C symbol its U+2103 in unicode.

Interesting that it appears with an underbar (underscore?) when displayed on your system. As mentioned above, nothing I tried displays it like that.

It presents a bit of a support headache when the symbol’s appearance can vary to such an extent. My phone browser renders the two symbols so that they’re virtually indistinguishable whereas yours adds something that isn’t even seen in my browser. What a mess; no wonder the OP is perplexed by it.

Any progress to report after you replaced the incorrect symbol with the correct one?