Numeric state interpreted as categorical (text)

This might turn out to be either a silly mistake or a misunderstanding of something more fundamental. I’m having trouble to even search for this. I thought I had a good grasp on this.

I have a numeric template sensor (old format):

- platform: template
  sensors:
    outside_temperature:
      friendly_name: "Outside Temperature"
      device_class: temperature
      value_template: >-
        {{ state_attr('weather.openweathermap_daily', 'temperature') | float }}
      icon_template: >-
        mdi:thermometer

But when I open the more info popup in Lovelace, it’s displayed as if it’s a text/categorical value:

The other sensors render as expected:

Now, it might be important to add: I only discovered this (oddly) last week after I’ve been using this for a very long time (more than a year). That’s when I added the | float to cast it, but it made no difference. I can’t figure out where the type inference might be happening.

Perhaps also relevant is that my recorder retention period is 7 days.

I’ve also directly queried my DB to check for any oddities:

homeassistant=> select * from states where entity_id like '%outside_temperature%' order by created desc limit 3;
-[ RECORD 1 ]+---------------------------------------------------------------------------------------------------
state_id     | 27753118
domain       | sensor
entity_id    | sensor.outside_temperature
state        | 12.8
attributes   | {"friendly_name": "Outside Temperature", "icon": "mdi:thermometer", "device_class": "temperature"}
event_id     | 32022397
last_changed | 2021-08-24 21:36:39.89558+02
last_updated | 2021-08-24 21:36:39.89558+02
created      | 2021-08-24 21:36:39.89558+02
old_state_id | 27751251

Add a unit_of_measurement to the template sensor.

I knew it was something silly, but was totally blind here. Thanks!

PS: And I should add, the cast I added actually won’t make a difference there, since it’s only useful when doing calculations at that point in the template. Once done, the output is a string again, and the unit of measurement is the thing that will cause it to be interpreted numerically within the Python code.